This sample shows how to use the MediaHistory and MediaHistoryItem classes to create a Music + Videos Hub app. It also uses the XNA MediaPlayer class to control playback of music. When the user presses the Play button, a history item is added to the Music + Videos Hub. You can then use this history item to launch the app and play that song immediately. If you start the app while a song is already playing in the media player, the app displays information about the song that is currently playing. For more info about integrating your app into the Music + Videos Hub, please see How to: Integrate with the Music and Videos hub for Windows Phone

Important Note:

You must install the Windows Phone SDK to run this sample. To get started, go to the Windows Phone Dev Center.

Note:

This sample is packaged as a Windows Phone 7.5 project. It can be converted to a Windows Phone 8 project, by changing the target Windows Phone OS version of the project. To create a Windows Phone 8 project, you must be running the Windows Phone SDK 8.0 on Visual Studio 2012. You can download the latest version of the SDK from http://dev.windowsphone.com/downloadsdk.

To convert the sample to a Windows Phone 8 project:

  1. Double-click the .sln file to open the solution in Visual Studio.

  2. Right-click the project in the Solution Explorer and select Properties. This opens the Project Properties window.

  3. In the Application tab of the Project Properties window, select Windows Phone OS 8.0 from the Target Windows Phone OS Version dropdown. A dialog will appear asking if you want to upgrade this project to Windows Phone OS 8.0.

  4. Select Yes to upgrade the project.