Search code examples
c#audiobackgrounduwpuniversal

Background audio stops playing when minimize windows 10 universal


I created an radio app for windows 10 using mediaElement for audio output with AudioCategory = BackgroundCapableMedia but whenever I minimize the app on desktop or mobile the audio stops playing. So how do I keep the audio alive after I minimize? And all examples I find is for 8.1 silverlight applications


Solution

  • You need to implement a Background Task to keep audio alive when your application is minimized.

    You can find a sample which targets Windows 10 on github. The project is splitted in 3 parts (a/ your main application b/ the background task and c/ code shared between the two first projects)

    Background audio sample

    In addition, you can find documentation associated to this sample on MSDN.

    Background Audio

    Please let me know if you need additional information.