MediaPlayer.MediaSource Property

Gets or sets the media file for the MediaPlayer.

Namespace:  System.Web.UI.SilverlightControls
Assembly:  System.Web.Silverlight (in System.Web.Silverlight.dll)

Syntax

'Declaration
<BindableAttribute(True)> _
<ThemeableAttribute(True)> _
Public Overridable Property MediaSource As String
    Get
    Set
'Usage
Dim instance As MediaPlayer
Dim value As String

value = instance.MediaSource

instance.MediaSource = value
[BindableAttribute(true)]
[ThemeableAttribute(true)]
public virtual string MediaSource { get; set; }

Property Value

Type: System.String
A string that specifies the media for the MediaPlayer control.

Remarks

The MediaSource property can be specified as a Uniform Resource Identifier (URI).

The media source can be of any type that is supported by Silverlight, which includes .wma, .wmv, .mp3, and .asx. For more information about the media types supported by Silverlight, see Supported Media Formats, Protocols, and Log Fields.

If the MediaSource is set to an .asx file, all media files listed in the file are played in the order they are listed in the file.

The following is an example of an .asx playlist file.

<ASX version = "3.0">
  <TITLE>Sample Playlist</TITLE>
  <ENTRY>
    <TITLE>Halo Video</TITLE>
    <REF href="halo.wmv" />
  </ENTRY>
  <ENTRY>
    <TITLE>Expression Studio Video</TITLE>
    <REF href="expression.wmv" />
  </ENTRY>
</ASX>

If the MediaDefinition is set to a media definition file that has a mediaSource element, that file takes precedence over the media file indicated by the MediaSource property.

For more information about creating client playlists, see ASP.NET MediaPlayer Server Control.

Examples

The following example demonstrates how to set the MediaSource property of the MediaPlayer class.

        MediaPlayer1.MediaSource = DropDownList1.SelectedValue.ToString()
        MediaPlayer1.MediaSource = DropDownList1.SelectedValue.ToString();

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

MediaPlayer Class

MediaPlayer Members

System.Web.UI.SilverlightControls Namespace