共用方式為


Playlist Object

[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 object provides a way to organize media items in a list for easy manipulation by using the following properties and methods.

The Playlist object supports the following properties.

Property Description
attributeCount Retrieves the number of attributes associated with the playlist.
attributeName Retrieves the name of an attribute specified by an index.
count Retrieves the number of items in the playlist.
name Specifies or retrieves the name of the playlist.

 

The Playlist object supports the following methods.

Method Description
appendItem Adds a media item to the end of the playlist.
clear Reserved for future use.
getItemInfo Retrieves the value of a playlist attribute.
insertItem Inserts a media item into the playlist at the specified location.
isIdentical Retrieves a value indicating whether the supplied Playlist object is identical to the current one.
item Retrieves the media item at the specified index.
moveItem Changes the location of an item in the playlist.
removeItem Removes the specified item from the playlist.
setItemInfo Specifies the value of a playlist attribute.

 

The Playlist object is accessed through the following properties and methods.

Object Property or method
Cdrom playlist
MediaCollection getAll, getByAlbum, getByAttribute, getByAuthor, getByGenre, getByName
Player currentPlaylist, newPlaylist
PlaylistArray item
PlaylistCollection newPlaylist

 

Because it is the most common means of access, player.currentPlaylist is used for purposes of illustration in the reference syntax sections.

See also

Object Model Reference for Scripting