Eliminates CORS issues for audio streaming in desktop apps
Expected behavior: The "Without Proxy" test should fail with CORS errors when accessing these external audio URLs directly from the browser, while "With Proxy" should successfully bypass CORS restrictions and play the audio by routing through the Desktop Audio Proxy server. This demonstrates how the library solves cross-origin access issues for desktop applications.
import { createAudioClient } from 'desktop-audio-proxy';
// Create client with auto-detection
const audioClient = createAudioClient();
// Convert any audio URL to a playable URL
const playableUrl = await audioClient.getPlayableUrl(
'https://example.com/podcast.mp3'
);
// Use in your audio element
audioElement.src = playableUrl;
import { TauriAudioService } from 'desktop-audio-proxy';
const audioService = new TauriAudioService({
autoDetect: true
});
// In your audio player
const streamUrl = await audioService.getStreamableUrl(originalUrl);
audioElement.src = streamUrl;
import { ElectronAudioService } from 'desktop-audio-proxy';
const audioService = new ElectronAudioService({
enableTranscoding: true
});
const streamUrl = await audioService.getStreamableUrl(originalUrl);