playing a video on the page in silverlight
I looked around on google and I'm not so sure what would be the best (in my case, fastest to build) way to have a video file that's on the server (what format should I store it in? wmv?) play on an aspx web page using .net 4.
I'd like to use silverlight with this snippet that I found online:
<MediaElement x:Name="MyVid"
Source="http://abc.xyz.com/MyVid.wmv"
Height="250"
开发者_开发百科 Width="350"
AutoPlay="False"/>
If you have experienced this situation and have suggestions that'd be great.
Thanks.
If your target requirements allow it, you should use Html 5 video tag. There are some good articles explaining how to use it.
To synthetise, you can use the video like this :
<video width="400" height="222" controls="controls">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
<source src="video.ogv" type="video/ogg" />
message if the browser is not html5 compliant here
</video>
You can specify several source, in order to support a larger number of browser (unfortunately, even if the video tag is standard, the CODEC are not).
Another good article is available in the Msdn France - "cahiers de vacances". The 1st volume is explaining the approach, and also the alternative for non-html5 browser, which consists in putting either a flash or SilverLigth player in place of the video tag.
精彩评论