Question

I am working on wondows mango app and I have two XAML pages(say page1 and page2). On page1 I have a playlist and on page2 I have a media element that plays the song selected on page1, now what I want is to keep song playing in background as user switches between pages. I got a few links that keep song playing when app gets in background but not when a page is closed(by clicking back button).

How can I achieve this, all suggestions, pointers are welcome.

Thanks, Ravi Gupta - :( newbie at windows phone

Was it helpful?

Solution

You'll want to use the BackgroundAudioPlayer for this. MSDN has a complete sample for playing audio in the background. You can download their sample from here. You can add a project to you application to handle processing background audio (if you need the audio to play after the app closes) or you can handle it all within the application itself my subscribing to the PlayStateChanged event. From the event you can set the next track.

OTHER TIPS

You can also use XNA's MediaPlayer() See: https://stackoverflow.com/a/11385865/1510036

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top