Creating a custom Silverlight 3 Smooth Streaming player

When it comes to video delivery, I come from a Flash background.  I’ve worked on numerous streaming video projects over the years, all of which were created with Flash & Actionscript on the client side. Having been through the process several times, I know all the hurdles I’m going to have to clear well in advance.

Documentation for coding a Silverlight 3 player against IIS Smooth Streaming is a little sparse.  IIS.net has several articles on the server setup, but I couldn’t find anywhere obvious regarding the client connection.

Unlike progressive video playback, you can’t just point the MediaElement.source at the video path then call play().  After a bit of searching, most people were talking about some AdaptiveStreamingSource class, which isn’t available in the base SL toolkit, but rather only found in SmoothStreaming.dll within the template players generated from Expression Encoder!

Per some handy forum posts, the steps required are:

  1. With Expression Encoder installed, go to C:\Program Files\Microsoft Expression\Encoder 3\Templates\en, select any template, and copy the SmoothStreaming.xap file.
  2. Rename your copied .xap file to .zip, unzip, and take out the SmoothStreaming.dll and PlugInMssCtrl.dll files.
  3. Reference these assemblies in your project, and you can then start using AdaptiveStreamingSource.

So, once you can finally access the required assemblies, you can then invoke your IIS Smooth Streaming service with something along the lines of the following:

var mediaPath = "testClip_h1080p.ism/manifest";
var source = new AdaptiveStreamingSource
{
   ManifestUrl = new Uri(mediaPath, UriKind.RelativeOrAbsolute),
   MediaElement = streamElement // the xaml MediaElement
};
source.StartPlayback();

Make sure you put the trailing ‘/manifest’ after your stream path.

Simple enough, once you’ve figured out the basics! Not exactly sure what MS were thinking by not including the SmoothStreaming assemblies in the SL3 toolkit? Surely they realise not everyone wants to use a templated player. Or have I missed something here?

This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>