Saturday, January 7

Media Player Contol using Silverlight and ASP.Net

In this article I am explaining the SilverLight Media Player Control in ASP.Net. With the media control one will be able to play stream media like audio, video files over the web page.
To use the SilverLight Media Player Control in ASP.Net. You will have to first download and install
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.

Silverlight MediaPlayer in the Visual Studion 2008 toolbox

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

Smart Tag to edit properties of SilverLight Media Player

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"
End Sub
Once all these settings have been done you run the application. The figure below displays the SilverLight Media Player.

SilverLight MediaPlayer playing a Windows Media Video (WMV) File

With this we finish the article. You can download the sample source code using the link below.

Shibashish mohanty 

No comments:

Post a Comment

Please don't spam, spam comments is not allowed here.

shibashish mohanty