Windows Media Player 11 SDK Static and Auto Playlists 

Windows Media Player SDK banner art

Previous Next

Static and Auto Playlists

There are two types of playlists:

  • Static playlists, which include specific media items
  • Auto playlists, which search the library every time they are opened and may contain different media items at different times. An auto playlist is the result of a database query.

To import a static playlist from a metafile, first call Player**.newPlaylist** to create a Playlist object based on the data in the metafile, and then pass that object to PlaylistCollection**.importPlaylist** to add the playlist to the library.

To import an auto playlist from a metafile, use MediaCollection**.add**. For more information, see Playlists and the MediaCollection Object.

To import a static playlist from an auto playlist metafile, use Player**.newPlaylist** and PlaylistCollection**.importPlaylist** as described earlier. The auto playlist will be executed once and a static playlist will be created based on the result of that execution.

Using an auto playlist to query the user's library is not supported for Web pages that users access over the Internet.

The following C# example code demonstrates importing an auto playlist metafile as a static playlist. To run this sample, create an auto playlist by using the library user interface, and then include the correct path to the auto playlist metafile in this code.

private void addStaticPlaylist()
{
    IWMPPlaylist pList;

    pList = Player.newPlaylist("NewImportedList", "\\\\myServer\\myPath\\artistcollection.wpl");
    if (pList.count == 0)
        MessageBox.Show("The specified playlist is empty.");
    else
        Player.playlistCollection.importPlaylist(pList);
}

See Also

Previous Next