MediaPlayer provides methods and properties for playing songs in the media library.
To control song playback, use the Play, Pause, Stop, and Resume methods. The MoveNext and MovePrevious methods move to the next or previous song in the queue. They operate as if the queue was circular. That is, MoveNext, when the last song is playing, moves to the first song. MovePrevious, when the first song is playing, moves to the last song.
To obtain visualization data for the currently playing song, call GetVisualizationData.
MediaPlayer is a static class, so you do not have to use new to instantiate an instance of the class. Instead, call methods and properties directly on the class.
Capabilities for Windows Phone
If you use this API in your Windows Phone app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.
|ID_CAP_MEDIALIB_PLAYBACK||Windows Phone 8|
|ID_CAP_MEDIALIB||Windows Phone OS 7.1|
For more info, see App capabilities and hardware requirements for Windows Phone.