Share via


Player.currentMedia

[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 currentMedia property specifies or retrieves the current Media object.

Syntax

player .currentMedia

Possible Values

This property is a read/write Media object.

Remarks

If the Settings.autoStart property is true, playback begins automatically whenever you set currentMedia.

This property takes a Media object, which can be acquired by using Playlist.item. To load a Media item using a file name, set the URL property or use newMedia.

Examples

The following JScript example retrieves the first media item in the library. It then uses currentMedia to make the retrieved media item the current media item, and then to display the name of the current media item. The Player object was created with ID = "Player".

// Retrieve the first media item from the library.
var firstMedia = Player.mediaCollection.getAll().item(0);

// Make the retrieved media item the current media item.
Player.currentMedia = firstMedia;

// Display the name of the current media item.
document.write("Found first media item. Name = " + Player.currentMedia.name);

Requirements

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

See also

Media Object

Player Object

Player.newMedia

Playlist.item

Settings.autoStart