ASPSnippets

Alerts
Get notified when a new article is published.

Name
 
Email

Your email will always be private and will not be shared.

Follow us on twitter.
 
Media Player Contol using Silverlight and ASP.Net
Author Name: Mudassar Khan Published Date: January 03, 2009
Filed Under :
ASP.Net
 |
Silverlight
Views: 6148

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

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.



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

C#

protected void Page_Load(object sender, EventArgs e)

{

    MediaPlayer1.MediaSource = "~/files/Butterfly.wmv";

}

 

VB.Net

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.

MediaPlayer.zip (3.15 mb)

To view video of the Media Player control in the Microsoft ASP.Net Website. Click here.


If you like this article, help us grow by bookmarking this page on any social bookmarking site.
Bookmark and Share Page copy protected against web site content infringement by Copyscape

Related Articles

Comments

Add Comments

You can add your comment about this article using the form below. Make sure you provide a valid email address
else you won't be notified when the author replies to your comment

Please note that all comments are moderated and will be deleted if they are
  • Not relavant to the article
  • Spam
  • Advertising campaigns or links to other sites
  • Abusive content.
There is no need to add BR tags. Simply press enter for new line

Name*  
Email*
Comment*  
Security code
Security code



 


Community News