MediaPlayer control included in Silverlight 3
For some reason I missed this until just recently, but Silverlight 3 comes with a MediaPlayer control courtesy of the Expression team. If you open the Assets panel and search for media, you’ll find both the MediaElement and the MediaPlayer, which you can then draw out on the artboard like any other control.
The MediaPlayer is very similar to the one that ships with Expression Encoder and mirrors the default theme. There is a ton of functionality built in: Playlist, Chapters, AutoLoad, AutoPlay, Offline, Popout, Transport Controls, Progress Bar, Volume Bar, Full Screen and Closed Caption buttons.
The best part is, that like any other control you can just right-click on the MediaPlayer and select the “Edit Template” – > “Edit A Copy…” option and you can modify the template to change the look and behavior of the MediaPlayer.
Another option is to reuse the different MediaPlayers available from Expression Encoder using the method outlined by Tim Heuer.
No need to start from scratch anymore.
The MediaPlayer control is installed by Expression Encoder, if you have Blend and not Encoder then that control won’t be in your Assets Panel.
Ah, thanks for the information Nigel. Now its all starting to make sense…
Is this natively part of the Silverlight 3 runtime, or a separate download?
Just confirming that I have the Blend 3 Trial installed and I do not have the MediaPlayer asset. I expect it will show up when I install the full Expression Studio 3.
@Stuart and @Joel – You need to have Expression Encoder 3 installed. It will then automagically register and add MediaPlayer control into Blend’s Asset pane from where you will be able to use it in the way Adam has described.I’ve played with the very same control few days ago and managed to get it to play HD YouTube videos with Silverlight. You can take a look here if you are looking for more details: http://www.uxpassion.com/2009/08/silverlight-tutorial-play-hd-youtube-videos-silverlight/Hope this helps,Vibor
Is there a simple way to implement the FullScreen functionality on clicking the Fullscreen button for this MediaPlayer in SL3 using only c# code? It seems something like this must be trivial, but I have not been able to find a good solution yet.
No, for security reasons Fullscreen mode can only be initiated by a user.
Hi Adam, i am just curious to know what security reasons would prevent from displaying direct full screen without user intervention.
I appreciate your response.
Hi Ajay,
The reason is to prevent screen spoofing. We have to be careful that an application doesn’t do something like impersonate the Windows login screen without the user’s knowledge.