Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
MediaPlayer muted when directly called from background task #1067
I am working on a alarm clock app that will play a music playlist using MediaPlayer upon the display of alarm toast (by listening for ToastHistoryChangedType.Added event in background task). The problem is that audio is muted even when Background Media Playback capability is enabled. Background audio only works when app is launched first in foreground before switching to background. This is not an issue in android and iOS, since both of them let users play audio from background tasks with user permission. But this is a roadblock for development in Uwp.
I tried it to find a workaround by using ToastAudio. Even though the toast audio documentation says that it will accept audio file located in ms-appdata:///, it does not work (it keeps playing default sound). ToastAudio only lets us to play custom audio located in ms-appx:///, but anything there has to be packaged with the application.
I request to loosen up the security here. A genuine app won't do an audio spam from background, and if it does, users will certainly not install it in first place and its review will be terrible.