naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.39k stars 1.09k forks source link

ROUTERING AUDIO FROM CEFSHARP TO SPECIFIC DEVICE #773

Open deccosantos opened 3 years ago

deccosantos commented 3 years ago

Hi I'm developing a CEFSharp Browser based app, and I need to allow client to change the output audio device for a song that is playing inside app. Is there a way to do this with NAudio?

Zintom commented 3 years ago

Look into MMDeviceEnumerator, specifically the EnumerateAudioEndPoints method, it allows you to enumerate all input/output devices and returns a MMDevice which represents the input/output device.

If you are playing audio via CefSharp directly then I'm not sure there is any integration that allows for Naudio to interact with CefSharp itself. However if you override the audio playing functionality of CefSharp and directly use Naudio for playback then you can use a WasapiOut to play audio, using the EnumerateAudioEndPoints method to select the output device.