Windows Media Player 11 SDK AxWindowsMediaPlayer.URL (VB and C#)
Previous | Next |
AxWindowsMediaPlayer.URL (VB and C#)
The URL property gets or sets the name of the media item to play.
[Visual Basic] Public Overridable Property URL As String [C#] public virtual string URL {get; set;}
Property Value
A System.String that is the URL of the media item.
Remarks
This property can only be set to a URL in a security zone that is the same or is less restrictive than the security zone of the calling program or Web page.
Applications that open media items from behind a firewall will have better performance if the address is specified using the domain name server (DNS) name instead of the IP address.
Do not call this method from event handler code. Calling URL from an event handler may yield unexpected results.
Example Code
The following example allows the user to specify a media file by entering a file path in a text box. When a button is clicked, the URL property is set to the specified file and the file is played. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
[Visual Basic]
Public Sub openMedia_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles openMedia.Click ' Set the URL property to the file path obtained from the text box. player.URL = inputURL.Text ' Play the media file. player.Ctlcontrols.play() End Sub
FakePre-1c3cb75e82b04d5e9929952f3e837f7f-e42afd43d97a478f8ea72c6a7593cfe7
private void openMedia_Click(object sender, System.EventArgs e) { // Set the URL property to the file path obtained from the text box. player.URL = inputURL.Text; // Play the media file. player.Ctlcontrols.play(); }
Requirements
Version: Windows Media Player 9 Series or later
Namespace: AxWMPLib
Assembly: AxInterop.WMPLib.dll (automatically generated by Visual Studio)
See Also
Previous | Next |