简体   繁体   中英

How do I route audio output to a selected audio endpoint/device in Windows?

TL;DR: When playing audio using Windows UWP MediaPlayer, how do I route audio to a specific audio device/endpoint?

Full Context

I'm working on an app to place calls. Some requirements are:

  • Play audio sounds at different points (eg when the call hangs up)
  • Allow users to change in-call audio output to different endpoints (not an issue)
  • Ensure that when in-call audio has routed to a different "default" endpoint, that any other sounds that are played are routed to the same endpoint ( this is what I need help with )

Currently, when I route audio to a different endpoint, other sounds that are played with Windows UWP MediaPlayer do not get routed to the same "new" endpoint. This makes sense since we aren't changing application-wide settings.

My question is: How do I route audio to the same endpoint that the call audio is going through, given that I'm using Windows UWP MediaPlayer and given that I can get device information?

When playing audio using Windows UWP MediaPlayer, how do I route audio to a specific audio device/endpoint?

Please check Output to a specific audio endpoint document. By default, the audio output from a MediaPlayer is routed to the default audio endpoint for the system, but you can specify a specific audio endpoint that the MediaPlayer should use for output. You could use GetAudioRenderSelector to get the render selector then use FindAllAsync to get render device the pass the specific device to mediaplayer AudioDevice property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM