MediaPlayer Class

Provides methods and properties to play, pause, resume, and stop songs. MediaPlayer also exposes shuffle, repeat, volume, play position, and visualization capabilities.

Namespace: Microsoft.Xna.Framework.Media
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static class MediaPlayer

Remarks

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 get and set playback options, use the IsMuted, IsRepeating, IsShuffled, PlayPosition, and Volume properties.

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.

See Also

Tasks

Playing a Song

Reference

MediaPlayer.Play Method
Song Class
MediaPlayer Members
Microsoft.Xna.Framework.Media Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone