Enhancing Media Experience in Silverlight with Microsoft Media Platform (MMPPF)
Introduction
When Silverlight introduced it was considered as a Player Framework because of its capability to handle Rich media. This is one of the first technology to handle true 720p and 1080p HD media. Since its evolution, Silverlight 1 to Silverlight 5 the digital media experience improved a lot. So this post we will take a dig into media concepts and its integration with Silverlight along with various option available.
This post will focus extensively on the Microsoft Media Platform Framework from Microsoft, a open source player framework and its implementation.

Media, Streaming, Silverlight… Journey So far
Silverlight 1 introduced MediaElement object to enable rich media experience. MediaElement
is a control region which enables rendering of audio as well video files. It supports Windows Media Video (WMV), Windows Media Audio (WMA), and MP3 files/ Containers. A detailed list of the formats and protocols supported, can be found with this link Supported Media Formats, Protocols, and Log Fields. Media element object supports Download and Streaming of media content to client side over HTTP. Other than these specified container types the Silverlight provides and option for MediaStreamSource
, which enables you to deliver media that doesn’t comes under the supported container type.
Other than format another important aspect of Media rendering is, how the content is going to be delivered at client. This is what called delivery method. There are various method of Delivery of content such as Streaming , Progressive Download , Smooth Streaming etc etc.
The MediaElement
decides on the delivery method based on file format type and
the URI.
The Default delivery behaviour of mediaElement
is progressive download. If you use the MediaElement
with a URL that starts with http: or https:, Silverlight begins a progressive download. If you use the MediaElement
with a URL that starts with mms:, Silverlight attempts to stream it, and falls back on a progressive download if streaming fails. Make a note that mediaElement doesn’t support Smooth Streaming.
Before going forward lets have a quick look into various delivery methods and its comparison.
Progressive Download | Streaming (Traditional) | Smooth Streaming or Adaptive Streaming |
Simple HTTP download of files | HTTP based yet stateful (Not exactly HTTP but a modified version of HTTP) | Hybrid combination of HTTP streaming with file chunk download |
Download a file chunks to client system and user have access to the content downloaded | Media sent as a series of packet to client | Media source is divided into many short segments and encoded. Chunks downloaded to client and played in linear sequence. |
Doesn’t consider the client environment | Can have multiple versions of file and based client environment can decide which version to send | Depending upon CPU and bandwidth usage changes the streaming quality level |
User can navigate between the downloaded portion | User can seek forward/backward of track | Smooth seeking |
Longer Initial Time for playback than Streaming | Fast Start-up, No buffering, |
If you want to explore in detail on above topics, have a look into the whitepaper published at Microsoft portal.
In the age of live streaming and on demand video the the smooth Streaming comes to rescue which delivers the best on a given network and client environment. So this leads to Microsoft Media Platform based player which makes it possible at client side to recognize the source content and enable smooth streaming.
Microsoft Media Platform: Player Framework 2.5
Microsoft Media Platform (MMPPF) is open source project from Microsoft that supports media plug-ins such as Smooth Streaming, Progressive Download and Windows Media streaming,.
Is this sufficient to use MMPPF? Why at all one should use the framework and what are the benefit it offers? The list bellow shows some of its profound feature in current version 2.5 that worth a shout out -
- Support for Windows Phone as well as Silverlight
- Media Plug-ins based on your choice (Smooth Streaming/Progressive Download /WMS)
- Slow Motion
- Playline Marker
- Customization and Branding
- Logging
- Advertisement Support
- Extensibility with Plug-in
- Streaming Graph Overlay
More detailed description of feature list can be found Here.
IIS Smooth Streaming
Make a note that the regular Streaming, progressive Download are default and come without any extra effort. Smooth streaming requires the files to be stored as chunks of different bit rate so that it can be streamed smoothly to client. Here the client choose which bit rate chunk to be downloaded based on client environment.
But sometime managing so much file chunks can be a difficult task at server so IIS Smooth streaming comes into picture. With IIS Smooth Streaming, file chunks are created virtually upon client request, but the actual video is stored on disk as a single full-length file per encoded bit rate. This offers tremendous file-management benefits.
But for IIS smooth streaming, IIS server need to be adequately configured and the video file needs to be encoded. There are many server / CDNs are available which offer smooth streaming service, how ever if you want to configure your server to support smooth streaming then refer to this article.
Player download and CodePlex Source
Before jumping to a sample application let me share you the download link and project hosted at CodePlex. It comes as a MSI package which can be installed. Basically it is a set of DLLs which can be referred in the project based on requirement.
- Download Installation – http://smf.codeplex.com/releases/view/63434#DownloadId=222617
- Project on CodePlex – http://smf.codeplex.com/
Creating a simple Media Player Project
Setting up the Project
Either you can download the binaries or else the complete MSI package which will add MMPPF template to the project window. Once you download the binaries as mentioned above you find a set of assemblies which can be used for based on scenarios. But for a very basic application we need to refer following assemblies into the project
Once you drag and drop the Microsoft.SilverlightMediaFramework.Core.dll to the toolbox, the SMFPlayer control allows you to use the control directly over page. (As the project was previously called as Silverlight Media Player (SMF) don’t bother about the control name).
On use of this control VS will include xmlns:smf=http://schemas.microsoft.com/smf/2010/xaml/player
namespace.
<Grid x:Name="LayoutRoot" Background="White">
<smf:SMFPlayer HorizontalAlignment="Stretch" Margin="0" Name="sMFPlayer" VerticalAlignment="Stretch" />
</Grid>
Quick Playing Media Source
PlayList
and PlayListItem
are the basic of MMPPF. PlayListItem
indicates the Media source object which is going to be added to Playlist collection of media. Each individual playItem has the option to choose its mode of delivery to the client. Following source shows creation of a Playlist item from a media source.
//Create a new PlayList Item
PlaylistItem item=new PlaylistItem();
item.MediaSource = new Uri("http://manaspatnaik.com/blog/downloads/Demolishor_WMV_HD.wmv");
item.ThumbSource=new Uri("http://manaspatnaik.com/blog/downloads/demolishor.jpg");
item.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming;
//Add PlaylistItem to the Media playlist
sMFPlayer.Playlist.Add(item);
sMFPlayer.Play();
Due to security reason or what so ever it does not support relative source to the playlist instead you can use absolute Uri path for the media item. Same as video Uri it does support Audio playback.
Playing a Smooth Streaming
As I mentioned IIS based smooth streaming needs the server to be configured and for demonstration I am going to use the sample media source hosted over playready.directtaps.net. The smooth streaming media source comes as. ism extension. Well direct use of this extension will not allow you to play the media. Instead you have to use the complete link including "/Manifest". This manifest files define the relationships between the media tracks, bit rates and files at server.
PlaylistItem item = new PlaylistItem();
item.MediaSource = new Uri("http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest");
item.ThumbSource = new Uri(thumbImgUri);
item.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.AdaptiveStreaming;
//Add PlaylistItem to the Media playlist
sMFPlayer.Playlist.Add(item);
Have a look at the difference between Progressive download and IIS smooth streaming at live link provided at the end of the article.
Embedding the Media Player to WordPress or Non Silverlight Site
Embedding the smooth streaming media player needs the XAP file which can be downloaded from here. Include the XAP file with in the root directory of your hosting provider and in the new wordpress post switch to HTML view where you can use following code.
<object data="data:application/x-silverlight-2," height="100%" type="application/x-silverlight-2" width="100%">
<param name="source" value="SmoothStreamingPlayer.xap" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />
<param name="InitParams" value="mediaurl=http://playready.directtaps.net/smoothstreaming/TTLSS720VC1/To_The_Limit_720.ism/Manifest" />
</object>
As above example is for smooth streaming it support only ism file, media source that only support IIS 7 smooth streaming. In case you want to host your own media URL then it needs progressive media player which can be downloaded here.
Sample Embedded player (Smooth Streaming ) – Embedded Player
Final Words
Media player framework offers lots of feature which I have hardly touched such as Logging, Analytics and Plugin. MMPPF is quite promising and one stop solution for all media rendering activities. Hope this post will give you a complete picture over Media handling capability that Silverlight does offer. Please feel free to post your views and comments.
Live Link and source code
- Live Link - http://manaspatnaik.com/app/MSMediaPlayerFrameworkTestPage.html
- Source Code – MSMediaPlayerFramework.zip
Additional Links and Reading
- Beginners Guide on Media Technologies - http://msdn.microsoft.com/en-us/library/ms867173.aspx
- Smooth Streaming Assets – http://playready.directtaps.net/smoothstreaming/
- Customizing MMPPF – http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays009
发表评论
UQHkf0 post and a all round exciting blog (I also love the theme/design), I don at have time to look
fbp3MO You certainly put a fresh spin on a subject that as been discussed for
SJQppK I truly appreciate this blog.Really thank you! Fantastic.
F28jJa IA?AаЂаve read several excellent stuff here. Certainly value bookmarking for revisiting. I wonder how much attempt you set to make this kind of wonderful informative website.
visiting this site dailly and obtain fastidious information from
upeZB2 You may have an incredibly good layout for your blog i want it to work with on my website also
53uJMB Im obliged for the article.Much thanks again. Want more.
oQWhYG Keep up the great work, I read few articles on this web site and I believe that your website is real interesting and contains bands of fantastic info.
RpOOTN
FxUucg Really informative article post.Much thanks again.
Ju8LKR Wow, superb blog layout! How long have you ever been running a blog for? you made blogging look easy. The whole glance of your web site is excellent, let alone the content!
HPVpnE I went over this internet site and I conceive you have a lot of excellent information, saved to my bookmarks (:.
KNFSb9 This keeps you in their thoughts, and in their buddy as feeds after they work together with you.
RqDRcN Well I sincerely liked reading it. This post procured by you is very practical for correct planning.
A2GlZa I simply could not leave your web site prior to suggesting that I actually loved the usual information a person provide for your guests? Is going to be again regularly to inspect new posts
MRnzk7 Right now it sounds like Movable Type is the preferred blogging platform available right now. (from what I've read) Is that what you're using on your blog?
tMkCwt I was suggested this web site via my cousin. I am no longer certain whether this submit is written by him as nobody else realize such designated about my problem. You are incredible! Thanks!
7Xpgb2 Looking forward to reading more. Great post.Much thanks again. Will read on...
4fKWyy Muchos Gracias for your article post.Really thank you! Fantastic.
fmExjV A round of applause for your blog article.Thanks Again. Keep writing.
a6HyjS Looking forward to reading more. Great post.Much thanks again. Want more.
UNNHux Thanks for sharing, this is a fantastic blog post.Thanks Again. Much obliged.
jrIQFd Really appreciate you sharing this article.Really thank you! Keep writing.
ZxN2jx A round of applause for your article.Really thank you! Really Cool.
C4HpkU Really informative blog.Really looking forward to read more. Keep writing.
DvWckR Hey, thanks for the article.Thanks Again. Awesome.
just registered here and wanna say hi you all.
cheers