Play Media from Isolated Storage in Windows Phone 8

Here’s a custom function that can be used to play media from isolated storage in Windows Phone 8 app. The code snippet also uses a global media element which enables background media in multiple pages in Windows Phone app. The media doesn’t keep playing when the app is closed but it continues playing even if you navigate away from that page. Here’s the function,

Just pass the name location of your media file as parameter to use this function. Declare AppMediaElement either at the top of the page or use this tutorial as a reference to enable background media in multiple pages.
How to enable Background audio in multiple pages in Windows phone application

Vivek Maskara

I am pursuing BTech in Software Engineering from Delhi Technological University. I develop apps, create websites and blog about my app experiences.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding