Freigeben über


Media.sourceURL

[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 sourceURL property retrieves the URL of the media item.

Syntax

player.currentMedia.sourceURL

Possible Values

This property is a read-only String.

Examples

The following JScript example uses Media.sourceURL to retrieve the URL of the first media item in the sample playlist; the URL of the media item is then assigned to the player object URL property. The Player object was created with ID = "Player".

// Store the sample playlist object in a variable. 
var pl = Player.playlistCollection.getByName("Sample Playlist").item(0);

// Store the first media item from the sample playlist.
var media = pl.item(0);

// Change the URL property of the player to the URL of the media item.
Player.URL = media.sourceURL;

// Play the media item.
Player.controls.play();

Requirements

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

See also

Media Object