Advertisement

Silverlight Media Framework 2 released–integrate with Live Writer

Yesterday (7-Jul-2010), the Silverlight Media Framework v2 was released on Codeplex (yeah, it’s Open Source).  If you aren’t familiar with it, it is a Silverlight framework encapsulating the best practices for media playback for Silverlight applications.  It is both a framework and, in v2, they also provided compiled simple player XAPs that you can just drop in HTML.  If you are building apps, you’ll want to take a look at the framework in more detail, but if you want a solid media player experience grab the players too.

Since I use Windows Live Writer as my blogging tool, I wanted to share my workflow for embedding videos into blog posts (or other content that I can author using Live Writer).  First, grab the necessary tools:

Install the Dynamic Template add-in for Writer.  Next step is to put your ProgressiveDownloadPlayer.xap somewhere.  This doesn’t matter, as along as you know the URL to it.  I keep mine on my cloud storage share since I can re-use it in various places.  Once all those pieces are in place here is what I do.

Step 1 – Create the Dynamic Template

In order to create a template, you have to execute the Insert function for Dynamic Template to bring up the dialog.  Once there, choose to Edit Templates and give it a name.

Dynamic Template insert dialog

Then in the template code, copy this HTML:

   1: <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480">
   2:   <param name="source" value="URL_TO_YOUR_PLAYER_XAP" />
   3:   <param name="background" value="white" />
   4:   <param name="enableHtmlAccess" value="true" />
   5:   <param name="minRuntimeVersion" value="4.0.50424.0" />
   6:   <param name="initParams" value="MediaUrl=<%= VideoUrl %>,AutoPlay=false,ThumbnailUrl=<%= ThumbnailUrl %>" />
   7:   <param name="autoUpgrade" value="true" />
   8:   <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.50424.0" style="text-decoration:none">
   9:       <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none" />
  10:   </a>
  11: </object>

And in the settings use these in this screenshot:

Code variables

Of course, replace with the URL to your player location.  That’s it, that is your template.

Step 2 – Prepare your media

I’m assuming that you already have media to display, but if you don’t, use your favorite media encoding tool to create the media and have the URL.  Note that it doesn’t have to be an absolute URL, but just understand the paths of your web app if you plan on using a relative URL.  Personally I recommend using an absolute one always.

Also the snippet above, while not required, implements the ThumbnailUrl (thanks Kevin) parameter for the player.  You’ll need a URL to a thumbnail image for preview.

Step 3 – Execute the template

Now that you have the template, you can use it.  Rather than talk about it, here’s an embedded video (using the process) demonstrating the process :-)…

Get Microsoft Silverlight

Simple, huh? Now of course you cannot see the final result in Writer (not sure why actually but I think it has something to do with the rendering techniques they use in authoring mode (hence the white box in the vid), but you can see the end result!

Summary

Silverlight Media Framework is awesome.  Live Writer is awesome.  Awesome+Aweomse = Awesomely Awesome.  Kidding aside, if you have similar workflows to me, this should help you.  It has streamlined the content publishing process when I need it in a simple, but efficient way.

Hope this helps!


This work is licensed under a Creative Commons Attribution By license.

  1. 7/8/2010 3:35 PM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    I love it when a plan comes together.
  2. 7/8/2010 10:49 PM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    So today, i got reply from microsoft connect
    silverlight related problem

    i test my old solution, i get error from visual studio 2010
    that i have to install developer runtime
    (remember your previous post, silverlight top issue, i think i somehow install silverlight plugin)

    then i decide to remove microsoft silverlight 4 by control panel
    re-install silverlight tool visual studio 2010
    i can run my silverlight again from visual studio....

    now on lunch time, i open your blog
    and get pop up, that this page require latest silverlight.....
    i'm to afraid to install the new one, since it's probably broke my developer runtime again...
  3. 7/8/2010 11:10 PM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    Andrew - you don't need to re-install the tools, but rather just upgrade the DEV runtime. You were auto-upgraded to the latest release of SL, however it wasn't the dev version. Direct link to DEV runtime: http://go.microsoft.com/fwlink/?LinkID=188039
  4. 7/8/2010 11:41 PM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    Just download and install silverlight runtime from your link,
    it's solve the issue, i can see your video

    so, Silverlight tool for visual studio 2010
    which i get from silverlight.net get started page
    is not updated....
  5. 7/9/2010 2:11 AM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    Hi Tim,

    Why doesn't Silverlight update automatically? I had to download and run the new version.
  6. 7/9/2010 7:30 AM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    Andrew -- as I said, the *tools* don't need to be installed again. The DEV runtime (http://go.microsoft.com/fwlink/?LinkID=188039) is the one that needs to be installed for developers (and this link is on silverlight.net)

    ColinM - it does update automatically depending on your settings with Microsoft Update and/or the settings for the plugin for auto-update.
  7. 7/9/2010 10:24 AM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    TimelineMarkerSkipped event does not work anymore with this release. Even documentation says this event is raised when a marker is reached instead of when a marker is skipped.
  8. 7/9/2010 10:29 PM | # re: Silverlight Media Framework 2 released–integrate with Live Writer
    Hi Tim,
    i bet you hate it, what if you download a software, run it and the software need to be updated
    and the link, i know it from you, not silverlight.net

    my point is, silverlight tool for visual studio must have the latest developer runtime
    even if i do re-install, i should have the latest one...

    i think, microsoft start to think to force an update, automatically hidden from user
    all internet explorer version updated to version 9 automatically
    and the world will be happy
    maybe start from silverlight ? :P



 
Please add 4 and 7 and type the answer here:
First time here? You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting! (hide this)