The premise of this article is that you have used silverlight3 (sl3) and installed expression encoder and expression blend3. If you have not installed encoder, you will not be able to use the mediaplayer control.
Sl3 already supports H.264. It is said that Sohu has used sl3 to develop HD applications, but the online address is not found yet :(
Let's talk about how to play YouTube's HD videos in the simplest way.
Here, the primary question is how to obtain the URLs of HD videos on YouTube. We can achieve this by using the Firefox plug-in greasemonkey and YouTube HD ultimate script. I believe it is not difficult to take care of you.
Here I get a URL for instructions and testing. The URL is as follows:
Http://www.youtube.com/get_video? Video_id = euwbiiiwcye & t = vjvqa1ppcfp0qthbkuhvzdm_uyxs8zusquz1jvlphyo = & FMt = 22
The next thing is very simple for those who are familiar with SL. Create a mediaelement control andSourceSet the property to the above address.
<Canvas x:Name="canvas1"> <MediaElement Source="http://www.youtube.com/get_video? video_id=euwBiiiWcYE&t=vjVQa1PpcFP0qThbkuhvZDM_uyxS8zusQuz1JvlPhyo=&fmt=22"/> </Canvas>
The use of mediaelement is so simple that when we decide to implement a video player, we must perform a considerable number of extensions on it. Because it neither has a playlist nor has the volume control, progress control, full screen, and other functions, it is definitely not a qualified video player.
So please have a grand debut of our protagonist mediaplayer control!
You can find it in the assets panel of blend3 and drag it to the canvas.
Mediaplayer looks like this.
Here, we only need to describe how to use the playlist. See the following XAML:
<ExpressionMediaPlayer:MediaPlayer > <ExpressionMediaPlayer:MediaPlayer.Playlist> <ExpressionMediaPlayer:Playlist> <ExpressionMediaPlayer:Playlist.Items> <ExpressionMediaPlayer:PlaylistItemMediaSource="http://www.youtube.com/get_video?video_id=euwBiiiWcYE&t=vjVQa1PpcFP0qThbkuhvZDM_uyxS8zusQuz1JvlPhyo=&fmt=22"Title="Star Trek Trailer" VideoHeight="800" VideoWidth="600"/> </ExpressionMediaPlayer:Playlist.Items> </ExpressionMediaPlayer:Playlist> </ExpressionMediaPlayer:MediaPlayer.Playlist> </ExpressionMediaPlayer:MediaPlayer>
You can add multiple playlistitem nodes to add the content of the playlist, which is easier to do in blend.
Is it cool? If you are a designer, you can right-click the mediaplayer control and choose "Edit template"> "edit a copy..." from the menu ..." To define a more niubility template for it.
OK. See you later ~