MediaPlayer.Play Method (SongCollection, Int32)

Plays a SongCollection, starting with the Song at the specified index.

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

public static void Play (
         SongCollection songs,
         int index


Type: SongCollection
SongCollection to play.
Type: Int32
Index of the song in the collection at which playback should begin.

Exception typeCondition
ArgumentException Play cannot be used when the song collection count is zero.
ArgumentNullException songs is null.
ArgumentOutOfRangeException index must be valid for the current collection.

Play clears the current playback queue, and then queues up the specified song collection for playback. It begins with the song at the specified index in the collection. Playback starts immediately at the beginning of the song.

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

Community Additions