IWMPMedia::sourceURL property
[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 gets the URL of the media item.
This property is read-only.
Syntax
public System.String sourceURL {get;}
Public ReadOnly Property sourceURL As System.String
Property value
A System.String that is the source URL.
Examples
The following example uses sourceURL to retrieve the URL of the first media item in the "All Music" playlist; the URL of the media item is then assigned to the player object URL property. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
// Get an interface to the All Music Playlist.
WMPLib.IWMPPlaylist pl = player.playlistCollection.getByName("All Music").Item(0);
// Store a WMPLib.IWMPMedia3 interface to the first media item in the playlist.
WMPLib.IWMPMedia3 media = (WMPLib.IWMPMedia3)pl.get_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.Ctlcontrols.play();
' Get an interface to the All Music Playlist.
Dim pl As WMPLib.IWMPPlaylist = player.playlistCollection.getByName("All Music").Item(0)
' Store a WMPLib.IWMPMedia3 interface to the first media item in the playlist.
Dim media As WMPLib.IWMPMedia3 = 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.Ctlcontrols.play()
Requirements
Requirement | Value |
---|---|
Version |
Windows Media Player 9 Series or later |
Namespace |
WMPLib |
Assembly |
|