共用方式為


Playlist.appendItem 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 appendItem method adds a media item to the end of the playlist.

Syntax

Playlist.appendItem(
  item
)

Parameters

item [in]

Media object to be added.

Return value

This method does not return a value.

Remarks

To use this method, full access to the library is required. For more information, see Library Access.

Examples

The following JScript example uses Playlist.appendItem to add the current media item to the playlist named "ThreeList". The Player object was created with ID="Player".

// Get the current media item.
var currMedia = Player.currentMedia;

// Get the playlist object by name.
var plThreeList = Player.playlistCollection.getByName("ThreeList").item(0);

// Append the media item to the playlist.
plThreeList.appendItem(currMedia);

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Playlist Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights