共用方式為


Cdrom.playlist

[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 retrieves a Playlist object representing the tracks on the CD currently in the CD drive or the root-level title entries for DVD.

player.cdromCollection.item(
        index
        ).playlist
      

Possible Values

This property is a read-only Playlist object.

Remarks

Typically, DVDs are 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 DVD, this method retrieves a playlist that contains as the first item a Media object that 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 one during playback results in the DVD playing from the beginning.

Additional items (Media objects) in the playlist are DVD titles that are represented by nested playlists. When you specify Controls.currentItem to equal one of these nested playlist items, Windows Media Player automatically sets the nested playlist as Player.currentPlaylist after chapter playback begins. You can then use the currentPlaylist object properties, methods, and 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.

Windows Media Player 10 Mobile: This property is not supported.

Examples

The following example uses Cdrom.playlist to fill an HTML text element, named myText, with the titles of the audio CD currently in the first CD drive. Use CdromCollection.count to determine the number of available CD drives. The Player object was created with ID = "Player".

// Store the CD playlist object.
var pl = Player.cdromCollection.Item(0).Playlist;

// Iterate through the CD track list.
for(var i = 0; i < pl.count; i++){

   // Print each CD track name.
   myText.value += pl.Item(i).name + "\n"; 
}

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Cdrom Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights