In this article I am explaining how to play (embed) WMV video file in ASP.Net using Silverlight Media Player.
To use the SilverLight Media Player Control in ASP.Net. You will have to first download and install
1. Visual Studio 2008 Service Pack 1
2. SilverLight 2.0 SDK
Once all these have installed, you can start building your Media Player Application. You will have to drag the MediaPlayer component from the Toolbox as shown in figure below.
By default there are no skins available when you install the .SilverLight Tools you can get the skin files in the Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\MediaPlayerSkin Folder. Just add the skins to your project using Add Existing Items in Visual Studio.
Next using the smart tag to choose the skin and add the Media File to be played
You can also set other parameters like the
Volume - sets the volume of the Media Player Control
Auto-Play – determines whether the media file will be auto played or not when it is loaded.
You can also set the Media Source from code behind as shown below
protected void Page_Load(object sender, EventArgs e)
MediaPlayer1.MediaSource = "~/files/Butterfly.wmv";
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MediaPlayer1.MediaSource = "~/files/Butterfly.wmv"
Once all these settings have been done you run the application. The figure below displays the SilverLight Media Player.
With this we finish the article. You can download the sample source code using the link below.