Microsoft Silverlight is a programmable web browser plug-in that enables features such as animation, vector graphics and audio-video playback which characterize rich Internet applications. Version 2.0, released in October 2008, brought additional interactivity features and support for .NET languages and development tools. Microsoft made the beta of Silverlight 3.0 available on March 18, 2009. The final version is expected to arrive on July 10, 2009.


It is compatible with multiple web browser products used on Microsoft Windows and Mac OS X operating systems. Mobile devices, starting with Windows Mobile 6 and Symbian (Series 60) phones, probably will be supported in 2010. A third-party free software implementation named Moonlight is under development to bring compatible functionality to Linux.

Today , MPEG video support for Silverlight 3 is here.It is difficult to implement but you can make it easily through this article.

I am developing Silverlight 3 solutions ; you can use Visual studio 2008 or Expression Blends.But here I am going to use Expression blends because it provides such tools to develop the XAML code you need to for Silverlight solution.Expression Blends is specifically designed with respect to designing purpose.You can download the version of Expression Blends (Blends 3 Preview release) from the Microsoft Expression Blends Official site , here you will find more things related to Microsoft Expression Blends.


Items you will will need to play back an MPEG-4 video in Silverlight are following :

  • A MPEG-4 video (the file extension will be .MP4).
  • Silverlight 3 Player(Latest player can be downloaded from ).
  • For instance, there have been two beta versions of the Silverlight 3 Player released. Only the second version will allow you to play back MPEG-4 video.

Now , I am going to start , following are the steps:

Step 1

First you have to do is to create a new a project from the File menu

ssdsdsdsddYou can choose to use either C# or VB.NET as your development language. Silverlight does also support JavaScript and other scripting languages.

Step 2

Blends will now create the files needed for a basic, empty project. You will see in the Projects explorer two sets of files. The progmic files refer to the development files you are working on; the progmicSite  files refer to the built files that will be used to publish your final project.


Step 3

Now you have to add a MPEG4 video file. To do this, right click on the progmic folder and choose “Add Existing Item.”


Selecting this command will allow you to search your hard drive for an MP4 file. The file will be automatically added to your project.

image5 You are now set to add the XAML code that will allow you to link to this file.

Step 4 : Working with XAML

Silverlight leverages the XML language called XAML to control the layout of objects on the screen. If you are familiar with HTML so you will not find difficulty to work with it.Well here you can able to choose to edit directly in XAML.

Paste the following XAML code into the code pane:

Width=”640″ Height=”480″>

<Grid x:Name=”LayoutRoot” Background=”White”>
<MediaElement AutoPlay=”True” x:Name=”MPEG_video” Source=”sample.mp4″ Stretch=”Fill” Margin=”0,0,0,0″/>

The play back of the MPEG-4 video file is controls by the MediaElement.Now you have to build your project and view the video playing back in your Web page through Silverlight.Expect the support for MPEG-4 and video in general to increase in Silverlight as it competes directly with Adobe’s Flash.