Share via


Windows Media Player 11 SDK About the Playlist, PlaylistCollection, and PlaylistArray Objects 

Windows Media Player SDK banner art

Previous Next

About the Playlist, PlaylistCollection, and PlaylistArray Objects

The Playlist, PlaylistCollection, and PlaylistArray objects govern the playlists that Windows Media Player can use to specify the order in which content will be played. You get the PlaylistCollection object from the playlistCollection property of the Player object. The playlistCollection property returns the PlaylistCollection object. You can only access the properties of the PlaylistCollection object after you have created it. For example, to create a new playlist, you must first get the PlaylistCollection object and then use a method on that object.

player.playlistcollection.newplaylist('myplaylist');

You can get the current playlist by using the currentPlaylist property. For example, to get the name of the current playlist, use the following code:

myname = player.currentplaylist.name;

The PlaylistArray object is returned by the getAll and getByName methods of the PlaylistCollection object. To get the number of playlists, for example, use the following code:

howmany = player.playlistcollection.getAll().count;

To retrieve a known playlist by name, use the following code:

if (player.playlistcollection.getbyname('myplaylist').count == 1) {
    pl = player.playlistcollection.getbyname('myplaylist').item(0);
}

See Also

Previous Next