Upload Video to Silverlight Streaming using WebDav

Follow up on the post from LaurentExpression Encoder 2 publish to Silverlight Streaming plugin”.

My way to upload is to use WebDav by mapping a network drive using my Silverlight Streaming Account ID as the user name and my Account Key as the password. You will find those information on the Administration Home page of Silverlight Streaming.

Then you have a direct access to your folders on Silverlight Streaming. You can then create a folder and upload your video with the name: video.vmw. And they will appear on your Manage Videos page.

Important: It is a must that the video are encoded in a format recognized by silverlight and that the name is video.wmv.

It rocks!


Two Great news from Silverlight Streaming!

First if you are using Silverlight 2 Beta 1, you will be able to upload your video with pause and resume. Second they finally deliver a HTTP endpoint for videos hosted in Silverlight Streaming.

We will make with Mathieu a great use of those two features soon :-)


Silverlight Streaming updated for Mix'08!

First of all it goes from 4Gb to 10Gb, whouah!

Get your free 10 GB hosting space now!

You can manage Video directly from the administration interface now!

Specify the video to upload using the Browse button, then type in a name and click on Upload. The video file must be smaller than 105 MB. This is equivalent to 10 minutes of video playback at a bit rate of 1.4 Mbps. Please wait as the upload may take a few minutes

And more

Silverlight Streaming (progressed to beta) – Use our infrastructure to deliver great experiences

Silverlight™ Streaming by Windows Live is the companion service to Silverlight. We are increasing the free hosting and storage limit to 10 GB and can now stream HQ content at 1400Kbps (see a sample here). During the SLS alpha we saw most scenarios were media driven (i.e. video/audio) – to make it easier for content producers to get their media in front of their users, we have introduced a Video Management scenario which allows media to be uploaded in many formats (Flash, DIVX, MPEG-4, QuickTime, H.264, H.263, WMV1, WMV2, MPEG-1, MPEG-2) and we will transcode the content into a Silverlight™ compatible WMV/VC-1 format. For developers we have introduced a new WebDAV API for Silverlight Streaming which allows for file by file management and Web Folders support - for more information go here.

The updated service and documentation will be available next week.

image_thumb14 image_thumb12


The new version of Tech Head Brothers will leverage all those new possibilities!


Alpha vertical slice of Silverlight Streaming on Tech Head Brothers

Tonight I reached a new milestone on my current development for my portal Tech Head Brothers.

You might know, or guessed, from one of my last post; "Tech Head Brothers Silverlight Streaming framework" that I am working on adding Silverlight Streaming to Tech Head Brothers. I first released a little framework to ease the development against the REST API of Silverlight Streaming. Now I went further on with a first vertical slice of the whole solution.

The solution is composed of four parts:

  1. a client application to post the video
  2. a service to receive the posted video
  3. an admin web application to publish the video
  4. a web interface to display the video

After quite some discussions with Mathieu about the best posting user experience for the different authors we finally decided that using Live Writer was the best solution! And now that I have the first vertical slice I am really happy about the choice we made, because it makes the solution easy for the authors but also for us implementing the solution.

The client application customize Live Writer with a SmartContentSource plugin letting the author upload it's video to Silverlight Streaming but also posting all information to Tech Head Brothers as a blog post.

The cool point here is that during the development of innoveo solutions website; my new company, I wrote a generic blog engine that basically let you define a blog just by adding an httphandler and implementing a Converter class:

Definition of a new blog, that will be used in the httpHandlers part of the web.config

    public class VideoBlog : GenericBlog<Video>
        public VideoBlog() : base(new VideoBlogAssembler())

Definition of the converter class, converting an business entity to/from a Post

    public class VideoBlogAssembler : IBlogAssembler<Video>
        /// <summary>
        /// Converts the specified video.
        /// </summary>
        /// <param name="video">The video.</param>
        /// <returns></returns>
        public Post Convert(Video video)
            Post post = new Post();

            post.dateCreated = video.PublishDate;
            post.description = video.Description;


The admin part was quick to develop just extending the page I already had for articles publication.

And finally Mathieu did a great job on the XAML Silverlight Player and all the javascript part that I juste needed to integrate.

So now you know it, yeah we are adding Video to Tech Head Brothers and I hope really soon.


Up to date with Silverlight Streaming

If you want to get all the latest news about the service you might read the blog or subscribe to the rss.


Tech Head Brothers Silverlight Streaming framework

Tech Head Brothers Silverlight Streaming framework is an implementation of Silverlight Streaming REST API as a class library and a set of Workflow Foundation activities focused on the Hosting Content on Silverlight Streaming.

I have implemented this light framework (some functionality are still missing) as a class library and Patrice Lamarche (http://patricelamarche.net) implemented the Workflow Foundation part of it.

The following picture shows the classes used in the framework:

It is basic with a Manager class (SilverlightStreamingManager) using a set of Command classes (AddFileCommand, DeleteFileCommand, GetFilesetFilesCommand).

Uploading a Video is as simple as those few lines:

            SilverlightStreamingManager mgr =
                new SilverlightStreamingManager("TOBEDEFINED", "TOBEDEFINED");

            string fileset = "testvideo";

            if (mgr.UploadVideo(@"T:\_Projects\Silverlight\SilverlightStreaming\media\fiona.wmv", fileset))
                Console.WriteLine("Uploaded sucessfully!! ");
                Console.WriteLine("Something went wrong !!");

You also might prefer to use the corresponding workflow activities delivered or even the sample workflow:



Silverlight Streaming hosting and Expression Encoder

How do you host your video content created with Expression Encoder on Silverlight Streaming ?

The first answer is wait for the plugin that will let you do that:

Coming Soon
Publish directly to Silverlight Streaming.

If you can't wait take a look at Silverlight Streaming SDK that tell you how to do it !

But how do you do if you want to have your video on Silverlight Streaming and your application on your site ?

Read the documentation. I have to say, it was quite obscure the first time I read it. So here is the way we did it with Mathieu.

The output of Expression Encoder is saved in the following folder:

C:\Users\Username\Documents\Expression\Expression Encoder\Output

In this folder you have everything to start with a very good looking player; the xaml, the JavaScript, your video, a html document, even a visual studio project. You might look at Tim Heuer video "cheating at creating a Silverlight media player".

To start you have to modify the default.html to use the Silverlight JavaScript script delivered by Silverlight Streaming:

<script type='text/javascript' src="Silverlight.js"></script>


<script type="text/javascript" src="http://agappdom.net/h/silverlight.js"></script>

This is recommended by the documentation, but it is not mandatory:

Instead of hosting Silverlight.js on your own web site and using it, you should use http://agappdom.net/h/silverlight.js

Then you have to modify the StartPlayer.js, replace:

function StartPlayer_0(parentId) {
    this._hostname = EePlayer.Player._getUniqueName("xamlHost");
    Silverlight.createObjectEx( {   source: 'player.xaml', 
                                    parentElement: $get(parentId ||"divPlayer_0"), 
                                    properties:{ width:'100%', 
                                                 isWindowless:'false' }, 
                                    events:{ onLoad:Function.createDelegate(this, this._handleLoad) } } );
    this._currentMediainfo = 0;      

with this, adding the initParams:

function StartPlayer_0(parentId) {
    this._hostname = EePlayer.Player._getUniqueName("xamlHost");

    Silverlight.createHostedObjectEx( {   source: 'player.xaml', 
                                        parentElement: $get(parentId ||"divPlayer_0"), 
                                        id: this._hostname, 
                                        properties:{ width:'100%', 
                                                     isWindowless:'false' }, 
                                        events:{ onLoad:Function.createDelegate(this, this._handleLoad) },
                                        initParams:"streaming:/4065/livewriterdemo/livewriterdemo.wmv" } );
    this._currentMediainfo = 0;      

Now you need a way to get back this the real url of you video out of the streaming:/4065/livewriterdemo/livewriterdemo.wmv, this is done automatically by the script doing a post to Silverlight Streaming server that returns the following javascript:

SLStreaming._StartApp("bl2", null
, {}
, []
, ["http://msbluelight-0.agappdom.net/e1/d/4065/8.w/63325188000/0.UZcUXMfJgIK0I0HcP-SQGzhvvVE/livewriterdemo.wmv"]);

Now we need to take car of the real url in the _handleLoad method we change the call to the _playNextVideo to a new method ChangeVideo:

StartPlayer_0.prototype= {
    _handleLoad: function() {
        this._player = $create(   ExtendedPlayer.Player, 
                                  { // properties
                                    autoPlay    : true, 
                                    volume      : 1.0,
                                    muted       : false
                                  { // event handlers
                                    mediaEnded: Function.createDelegate(this, this._onMediaEnded),
                                    mediaFailed: Function.createDelegate(this, this._onMediaFailed)
                                  null, $get(this._hostname)  ); 
    ChangeVideo: function(){            

        var params = $get(this._hostname).InitParams;
                { "mediaUrl": params, "placeholderImage": "", "chapters": [] }  

We get access to the initParams converted to a real url using:

        var params = $get(this._hostname).InitParams;

Tanks to Mathieu for the help in the javascript coding.

So this is all you need to do to have your video hosted and delivered by Silverlight Streaming and your application hosted on your own site.


Silverlight and file system loading

I am currently working with Silverlight and Silverlight Streaming and had an issue over the weekend I am sure I will not be the last one to have so:

Don't try to load a Silverlight application from the file system, I mean double clicking an html file, prefer to have a little web application or even use "Starting ASP.NET Development Server from a right click in explorer" to test your application.

The security used in both cases is different so it makes the difference.

Thanks to Mathieu for the support in the development and Jon Galloway for the support in troubleshooting the issue.


Video of Tech Head Brothers authoring tool using Silverlight Streaming

This is a video demonstrating the offline usage of the Tech Head Brothers authoring tool.

The tool is using now WCF in place of WSE3 and works great with ASP.NET membership and role.

The video is hosted on Silverlight Streaming and was made using Camtasia Studio from TechSmith and Microsoft Media Encoder.

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect, certified Scrum Master and Founding Member.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status



This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List