共用方式為


Player.newPlaylist method

[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 newPlaylist method creates a new Playlist object.

Syntax

retVal = Player.newPlaylist(
  name,
  URL
)

Parameters

name [in]

String containing the name of the new playlist.

URL [in]

String containing the URL of the Windows Media metafile playlist to create the Playlist object with.

Return value

This method returns a Playlist object.

Remarks

If the URL parameter is set to null or "" (empty string), an empty Playlist object will be created. If the name parameter is set to "", the name in the metafile is used.

The new playlist created with this method is not added to the library. To add a new playlist to the library, use PlaylistCollection.importPlaylist or PlaylistCollection.newPlaylist. Any leading or trailing spaces in the playlist name are automatically removed when it is added to the library.

Because the library allows multiple playlists with the same name, you may want to check for the presence of a playlist with a given name before adding a new one.

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later.
DLL
Wmp.dll

See also

Player Object

PlaylistCollection.importPlaylist

PlaylistCollection.newPlaylist

Windows Media Metafiles