Progressive Digressive Marcus Whitworth's tech blog – .NET, C#, Silverlight, WPF, Flex…etc, etc

24Sep/090

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?


Kick It on DotNetKicks.com

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

24Sep/090

Visual Studio Silverlight/xaml bug

This one was driving me crazy for at least a few hours.  On a fresh install of VS2008 & Silverlight 3 tools, there was no xaml code highlighting at all, no intellisense, nothing - just like any ordinary text file.  Checking the same project on another machine, it was all fine.  So I starting disabling/uninstalling all VS plugins (ReSharper, AnkhSVN), but still no luck.  Was starting to think I'd have to reinstall VS...

The solution was simple enough - run the VS Command Prompt, and enter:

devenv /resetskippkgs

Problem solved.  Apparently a good one to try whenever you lose formatting or Intellisense features.


Kick It on DotNetKicks.com

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

23Sep/090

10 Enterprise Architecture Pitfalls

An interesting article from Gartner Analysts.  I know I've been involved in many projects over the years which touch upon most of these issues at some point.  The benefit of hindsight :)


Kick It on DotNetKicks.com

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

15Sep/092

.NET Development on a Mac – Fusion or Parallels?

I've been recently issued with my first Mac for work, and have been in the process of setting it up as my dev machine.  I'm familiar with using Mac's in several roles over the years, but resisted using one day-to-day until now.  I've got the base level Macbook Pro (2.26mhz, upgraded to 4gb ram).

Among other apps, I need to run Visual Studio 2008 and SQL Server 2008.  Using Bootcamp crossed my mind, but I didn't like the the idea of rebooting into Windows every time I wanted to look at something dev-related.

So, I downloaded the trial of VMWare Fusion 2.05, installed a shiny new copy of Windows 7 Pro, installed VS2008 Pro, SQL2008, ReSharper, etc, and prepared to be amazed by my new efficient setup.

In short, it was pretty painful - everything just seemed to lag.  I was expecting it to be a bit slower than running natively, but after 20 minutes I realised it just wasn't going to work.  I googled to see if this was a common experience, and came across this fairly comprehensive comparison between Fusion and Parallels which concludes "Parallels Desktop is the clear winner running 14-20% faster than VMware Fusion".  That's an impressive difference on any benchmark!

One very nice feature of both Fusion and Parallels is that you can import the competitor's virtual image into the other.  So after reading this comparison, I figured I had nothing to lose - the next option was to just set up in Bootcamp which still wasn't appealing.  I downloaded and installed Parallels 4, imported my Fusion virtual image, and 20 mins later I booted up the new Parallels image.

This was exactly what I was hoping for - the experience was vastly superior.  No obvious lag when opening/closing programs, responsive, didn't slow down my other Mac programs at all, and just slicker.  Build times of existing VS projects may be a bit slower than running natively (understandable given only one cpu core is allocated to the virtual OS - I think), but overall it feels pretty snappy, and definitely not slow to the point I'd bother rebooting into Bootcamp.  It's worth pointing out that I allocated 2gb memory (of 4gb total) to running each Fusion and Parallels - so they were on a fairly level playing field.

Parallels: 1 - Fusion: 0


Kick It on DotNetKicks.com

Post to Twitter Post to Yahoo Buzz Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon