472,143 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Silverlight Mediaelement to play Video


I am new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video.
Expand|Select|Wrap|Line Numbers
  1. <Canvas>
  2.            <MediaElement x:Name="mPlayer" Width="640" Height="480" Source="a_video.avi"/>
  4.             <Button x:Name="bPlay" Background="Green" Width="100" Height="45" Canvas.Left="8" Canvas.Top="497" Content="Play" />
  5.             <Button x:Name="bPause" Background="Yellow" Width="100" Height="45" Canvas.Left="112" Canvas.Top="497" Content="Pause"/>
  6.             <Button x:Name="bStop" Background="Red" Width="100" Height="45" Canvas.Left="216" Canvas.Top="497" Content="Stop"/>            
  7.         </Canvas>
And I placed that video file in Xaml folder but when i run the application i am not getting any results to play video. The steps I followed are correct or anything missed.
Please help me how to play video using silverlight mediaelement and mention the steps to play video and where i have to place video to use it in mediaelement source property.

Thanks in advance
Mar 2 '09 #1
3 8483
9,735 Expert Mod 8TB
Have you checked out this video tutorial? I think it could help you.
Mar 2 '09 #2
Please read this or watch the proposed video.

I don't think media element supports avi files.
Mar 9 '09 #3
I notice that this is an old post, but at the time of your posting it may not have been possible to play AVI files.

But since Silverlight 4 (using media element and mediastreamsource) and the just released Silverlight 5 RC (using P/Invoke), you can play AVI files.

But please note that the code will only run on Windows platform.

check out my how-to articles at codeproject.com:

Silverlight 4: http://www.codeproject.com/KB/silver...eamSource.aspx

Silverlight 5 RC: http://www.codeproject.com/KB/silver...mSourceS5.aspx

good luck.
Sep 13 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Piotrekk | last post: by
reply views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
1 post views Thread by Faisal Shafiq | last post: by
3 posts views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
13 posts views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.