IWMPMedia::sourceURL-Eigenschaft

Die sourceURL-Eigenschaft ruft die URL des Medienelements ab.

Diese Eigenschaft ist schreibgeschützt.

Syntax

public System.String sourceURL {get;}

Public ReadOnly Property sourceURL As System.String

Eigenschaftswert

Eine System.String,die die Quell-URL ist.

Beispiele

Im folgenden Beispiel wird sourceURL verwendet, um die URL des ersten Medienelements in der Wiedergabeliste "All Musik" abzurufen. Die URL des Medienelements wird dann der URL-Eigenschaft des Playerobjekts zugewiesen. Das AxWMPLib.AxWindowsMediaPlayer-Objekt wird durch die Variable player dargestellt.

// 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 (Anforderungen)

Anforderung Wert
Version
Windows Media Player 9er Serie oder höher
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Weitere Informationen

IWMPMedia-Schnittstelle (VB und C#)