Partager via


IWMPCdrom::Playlist property

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

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.

Syntax

public IWMPPlaylist Playlist {get; set;}

Public ReadOnly Property Playlist As IWMPPlaylist

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.

Examples

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.
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;

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

&#39;  Create a string array to hold the track list.
Dim trackList(playlist.count) As String

&#39;  Iterate through the CD playlist.
For i As Integer = 0 To (playlist.count - 1)

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

Next i

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

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPCdrom Interface (VB and C#)

IWMPControls.currentItem (VB and C#)

IWMPMedia Interface (VB and C#)

IWMPPlaylist Interface (VB and C#)

IWMPSettings2.mediaAccessRights (VB and C#)

IWMPSettings2.requestMediaAccessRights (VB and C#)