Windows Media Player 11 SDK IWMPCdrom.Playlist (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPCdrom.Playlist (VB and C#)

The Playlist property gets an IWMPPlaylist interface representing the tracks on the CD currently in the CD drive or the root-level title entries for a DVD.

  

Property Value

A WMPLib.IWMPPlaylist interface.

Remarks

Typically, DVD-based content organized into titles. Each title contains one or more chapters. Each DVD is authored differently, so how titles and chapters are used is up to the content author.

For a DVD, this property gets a playlist that contains as the first item an IWMPMedia interface named "DVD". This interface represents the DVD media. Playing the item results in the DVD playing from the beginning if it is the first play after inserting a new DVD, or resuming playback if the DVD is the same as the last DVD viewed. Setting this item as the current item during playback results in the DVD playing from the beginning.

Additional items (represented by IWMPMedia interfaces) in the playlist are DVD titles that are represented by nested playlists. When you set IWMPControls.currentItem to equal one of these nested playlist items, Windows Media Player automatically sets the nested playlist as the current playlist after chapter playback begins. You can then use the IWMPPlaylist interface properties, methods and associated events to work with DVD chapters, which are also playlist items.

To retrieve the value of this property, read access to the library is required. For more information, see Library Access.

Example Code

The following example uses Playlist to fill a multi-line text box, named myText, with the track list of the audio CD currently in the first CD drive. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
'  Get an interface that provides access to the CD playlist.
Dim playlist As WMPLib.IWMPPlaylist = player.cdromCollection.Item(0).Playlist

'  Create a string array to hold the track list.
Dim trackList(playlist.count) As String

'  Iterate through the CD playlist.
For i As Integer = 0 To (playlist.count - 1)

    trackList(i) = playlist.Item(i).name

Next i

'  Display the list of CD tracks in a multi-line text box.
myText.Lines = trackList

FakePre-e1f82b04f4fe4d2bb8ba4cc5beb6152c-4baad490b987433faccb35df64c77c47

// Get an interface that provides access to the CD playlist.
WMPLib.IWMPPlaylist playlist = player.cdromCollection.Item(0).Playlist;

// Create a string array to hold the track list.
String[] trackList = new String[playlist.count];

// Iterate through the CD playlist.
for (int i = 0; i < playlist.count; i++)
{
    trackList[i]= playlist.get_Item(i).name;
}

// Display the list of CD tracks in a multi-line text box.
myText.Lines = trackList;

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next