Partager via


Using Auto Playlists to Organize Content in the Library

[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.]

You can use auto playlists to organize premium content you provide. For example, you could use Windows Media Player to create an auto playlist that contains only content you provided having a user rating of at least four stars. You can then add the auto playlist to the library in Windows Media Player so that it displays in the Purchased Music node under your content distributor node.

To do this, follow these steps:

  1. Create the auto playlist.
  2. Using Windows Explorer, browse to the auto playlist and retrieve the .wpl file.
  3. Using the Windows Media Player object model, add the auto playlist to the library.
  4. Set the WM/ContentDistributor attribute for the playlist to your content distributor key name.
  5. Set the SyncOnly attribute for the playlist to true.

The following JScript example code shows a function that adds an auto playlist named "Favorite Hits" to the Proseware node in the library:

function AddWPL()
{
    var pl = Player.mediaCollection.add("c:\\media\\Favorite Hits.wpl");
    pl.setItemInfo("WM/ContentDistributor", "Proseware");
    pl.setItemInfo("SyncOnly", true);
}

About Library Integration

Information Common to Type 1 and Type 2 Online Stores

MediaCollection.add

Playlist.setItemInfo

Static and Auto Playlists

SyncOnly Attribute

WM/ContentDistributor Attribute

Working with the Library