This project has moved and is read-only. For the latest updates, please go here.

Is there a way to have background audio while app is in background state and video when app is running in the foreground

Feb 26, 2015 at 6:29 PM

I'm developing Windows Phone 8.0 application which uses PlayerFramework and SM.Media.MediaPlayer.WP8 to play video stream.

But I want my application to continue playing the audio when the user "minimize" the application.

Is there a way to implement this feature in Windows Phone 8?
If the answer is no ... then will it be possible if I upgrade my project to Windows Phone 8.1 Silverlight?
If the answer is still no ... then will it be possible if I rewrite my application to target Windows Phone 8.1 (Windows Runtime) framework?

Thank you
Feb 27, 2015 at 12:52 AM
Windows 8 supports what you are trying to do, but I don't know any way to do this on WP (perhaps when WP10 comes out...). The closest I think you can come on the phone is to add the background audio stuff to your app and start it playing when the normal app switches to the background. If you are playing a VOD-type stream, you will want to communicate the current position between the foreground and background processes (and they really are different processes, not threads). There will be a noticeable discontinuity when this happens. IIRC, Microsoft's WP8 background audio sample code has examples of how to communicate with the background audio process through the filesystem. WP8.1's background audio has a key/value based RPC mechanism that could be extended to support this.

I've thought about this before since sometimes I listen to talking-heads type stuff with headphones while doing dishes and the like. It seems silly to waste battery having video playing, with the screen on, while the phone is in my pocket.