Using smooth streaming video client in windows phone 7

Untitled-2Today the Smooth Streaming Client was updated to also work for the Windows Phone 7 and looking in to video streaming for an upcoming project this was indeed very good news. (Lets just hope the Silverlight Media Framework will be upgraded as well!) The first test I did was to check how easy it would be to at least add and view a streaming file in Windows Phone 7.

In my case I wanted to check if it was possible to play in a mixed view, not only a full screen video view. So I created a simple application with both a video and some surrounding text. Looking something like the image to the right, with live video in the small player.

First things first, download the client software from the above link and install it. After that add a reference to Microsoft.Web.Media.SmoothStreaming and add the reference in the XAML as well:

xmlns:ss=”clr-namespace:Microsoft.Web.Media.SmoothStreaming;assembly=Microsoft.Web.Media.SmoothStreaming”

The its just a matter of adding the SmoothStreamingMediaElement in the code and point the SmoothStreamingSource to a smooth streaming video source. However, here comes a little problem (that a proper prototype would have solved, hrm, Microsoft). The emulator doesn’t support that many codecs, even if the phones will support a lot. But a normal SD quality VMA encoded smooth streaming source did the trick for me. The MSDN documentation has most of the information needed to get it right. My final bits an pieces for the smooth streaming media element lookes like this:

Of course the [server] and [file] content should be set to something you have access to. The biggest problem for me was to get hold of an appropriate stream source, luckily for me (as I didn’t have the time to set one up myself nut it shouldn’t be that hard) I was able to use a stream from an internal project just to test things out.

As soon as I get my hands on the real hardware I will try it with Big Buck Bunny

This Post Has 6 Comments

  1. saurav

    Hello Håkan,
    We did the following:
    1) Downloaded your application StreamVideo.zip

    2) Encoded a .wmv file using Expression Encoder 4. In preset option we chose
    following (a) IIS Smooth Streaming – SD 480p VBR and (b) VC1 – Variable bit rate – VC1 256K DSL VBR

    3) Hosted these encoded video in IIS7.

    4) Now we are giving the path as –

    Output we getting is a blank player without any video.

    Could you please give us some pointers to solve this out? It would be a great help.

    Regards,
    Saurav

    1. Håkan Reis

      I guess you are using it on the Emulator and it’s extremly picky with the formats used and the size you use to show the media. If you look into the MSDN document: http://msdn.microsoft.com/en-us/library/ff462087(VS.92).aspx, you can see exactly what formats are supported.

      I would, at first, try the stream in a normal Silverlight app, just to make sure it is ok, before trying it in the windows phone emulator. My guess is that either you are trying to view it in a too big window or the avarge bitrate is to high. But thats just a guess. Ideal would be to have an actual device to try it out on.

      // Håkan

  2. Pankaj

    Hi Håkan,
    I did the following things
    Encoded a .wmv file using Expression Encoder 4 with preset option i chose vc1 IIS smooth streaming HD720p VBR,hosted this video on IIS7
    Downloaded StreamVideo.zip
    Provided the path for video but when i am running this application i am getting nothing (blank application).

    Please can you give us bit details about the application with videos.

    Thanks & Regard
    Pankaj Kadlag

    1. Håkan Reis

      The problem is with the high resolution 720p is to much to work on the emulator (though it should be OK in a device). Max bitrate is 480p for emulator. See the link in prev comments, the document from MSDN clearly outline all video encodings that are valid and what is valid on the emulator.

      I can’t hand out the video as it’s to big and from a customer project. It was about 20min clip in 480p to make sure it didn’t download before it started to stream.

      Regards // Håkan

  3. Pankaj

    Hi Håkan,
    Can i get proper encodeing format for wmv file as i am using Microsoft Expression Encoder 4
    Thanks & Regard
    Pankaj Kadlag.

Leave a Reply