ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

In the earlier post, we saw the "Dynamic Data Website" shipped with ASP.NET 3.5 Extensions Preview that can be used for rapid application development of data driven websites using Visual Studio 2008.

The ASP.NET 3.5 Extensions Preview can be installed from here  Once you install the same, you get a few things.  One, is that you get the 'Dynamic Data Website' template I talked about earlier.  The other thing is that you get the "ASP.NET 3.5 Extensions Website" template that allows you to create an ASP.NET 3.5 Website with the Extensions Preview features.

I know its confusing at this moment.  If you read back, we released ASP.NET 3.5 and Visual Studio 2008 during the fag end of 2007.  Along with that we also released an ASP.NET 3.5 Extensions Preview, a build that is currently a CTP where we are testing some of the new features that could be integrated as a part of SP1 for .NET 3.5 (and subsequently ASP.NET 3.5)

One of the features of the ASP.NET 3.5 Extensions is the Dynamic Data Controls that allows you to create Data Driven Websites using the LINQ to SQL and Dynamic Data Controls.  The other feature is the ASP.NET 3.5 Extensions Website that allows you to create ASP.NET Website where you can use all the controls / features that are currently in preview.

Phew !!!

So, once you create this ASP.NET 3.5 Extensions Website, the first thing you would notice is that, the version of AJAX (System.Web.Extensions.DLL) is 3.6.0.0 as opposed to 3.5.0.0. that would be in the case of a normal ASP.NET 3.5 Web Site (File - New - Website - ASP.NET Website in Visual Studio 2008).  Also you must be able to see a new tab in the toolbox reading "ASP.NET 3.5 Extensions".  Some of the controls that would be present in this tab are the ListView, DataPager, UpdatePanel, UpdateProgress, Timer and the ScriptManager, ScriptManagerProxy controls.  The version however, for these controls is again 3.6.0.0. which means that they would be the newer versions currently under preview.  The other things that you would notice is the Dynamic Data Controls like DynamicListView, DynamicDetailsView, DynamicGridView and DynamicFormView.  We will see about these controls in a later post.

The third set of controls you would notice are Silverlight and MediaPlayer controls which are very handy controls.  The MediaPlayer controls allows you to play videos on your ASP.NET Pages without the need to do much work.

Lets start examining this.  Open Visual Studio 2008, select "File - New - Website" andchose the "ASP.NET 3.5 Extensions Website"

Once you create the website, open the Default.aspx page and also expand the ASP.NET 3.5 Extensions Toolbox tab.  Drag and Drop the MediaPlayer control to your webpage.

Next is that we need to add a Video to our site.  Go to the root of the website and create a folder named "Videos" (We could do without this, but just a logical grouping).  Add an existing video that you can pick up from your machine.  By default, Windows Vista and Windows XP ships the Butterlfy.wmv and a couple of videos that you can use, in case you dont have any video on your machine.  These files (Butterfly.wmv etc.,) are usually located in C:\users\<username>\videos\Sample Videos in case of Windows Vista and at C:\Documents and Settings\<user name>\My Documents\My Videos in case of Windows XP.

So you can add these videos or any other video that you have in your machine to the 'Videos' folder that we created in the root of the website.

Now, switch to design view of the Default.aspx page and select the MediaPlayer Control.  You should see a "Silverlight" logo which indicates that the video would be hosted by Silverlight for the end users.  Click on the smart tag that shows up next to the MediaPlayer control where you can set the MediaPlayer Tasks.  Click on the browse button next to the Media Source TextBox to chose the video file.  It currently supports File formats.  You can chose a video of this file format from the 'Videos' folder that we created.  You can alWMV, MP3, WMA and ASX so set it to Mute or AutoPlay and change other properties using the properties window.

Thats it! You are good to go and play Videos in your web page.  The great advantage is that, this doesnt require the end users to have Windows Media Player to be installed since this would be powered by Silverlight.  The end users just need ot install Silverlight runtime for the first time and with the flood of Silverlight applications that we are witnessing these days, there are more than likely chances that your end users have already Silverlight running in their machines.  This means that you can play Videos on your ASP.NET Web pages without having any additional client installation.

For more information on further exploring MediaPlayer and creating chapters, check http://quickstarts.asp.net/3-5-extensions/silverlight/MediaPlayerControl.aspx

Cheers !!!

Print | posted on Tuesday, January 29, 2008 1:18 AM

Comments on this post

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
Does this mediaplayer use ActiveX? If so, than it won't work in Firefox and other browsers. Can i find some general solution for this?
Left by Ron on Jun 28, 2008 12:40 AM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
Hello,

I have tried to use the media player control in an aspx page and I see the control on the screen but the play button is disabled and the media does not play, I've tried setting the properties differently for autoplay true/false etc and I'm not sure why it's not working.I'm using Microsoft Silverlight
Version: 2.0.30523.8
Visual Studio 2008 SP1
I've done the following:
1) C#, WEB, ASP.NET WEB APPLICATION
2) Added Media Control from Toolbox under Silverlight Tab.
Added existing .wmv resource to my appdata folder,
referenced my .wmv file in media control media source property.

Can you tell me what I'm doing wrong???

Thanks

Ron G
Left by Ron G on Sep 03, 2008 5:29 AM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
please help me how to play media files with the help of asp.net application.

please send me demo program or code.

or if any contol is there please tell me how we add that control in my application.
Left by Nitesh on Oct 16, 2008 6:46 PM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
Asp.net media player
Left by Bhimpal Singh on Nov 29, 2008 9:29 AM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
hi plz give to me to access this web site
Left by santhi on Feb 17, 2009 6:56 PM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
Amazing there is now template for dynamic website
Left by nursing essays on Feb 12, 2010 3:07 AM

# re: ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

Requesting Gravatar...
GÜZEL ALINN KULLANIN
Left by meksika biberi zayıflama hapı on May 31, 2010 11:22 PM

Your comment:

 (will show your gravatar)