This project is read-only.

Windows Azure Live Streaming solution allows quickly deploy scalable service to perform live video broadcasting through Windows Azure Web Roles.

Solution source code is available for download from

High level architecture presented in the following diagram:


Upstream Server (

Single instance Web role with Push publishing point (aka “ingest” server). URL of this publishing point used by Encoder to push video stream during Live event.

Important: to achieve redundancy for Push point it’s possible to deploy additional single Web role at different DNS. Azure staging deployment will work as well.

Upstream Server could be used as streaming server in small scale deployments. In this case player URL would be 

Downstream Server (

Multiple instances Web role with Pull publishing point. URL for this publishing point (e.g.

IIS Media Services 4

IIS Media Services 4 is automatically installed and configured via Web role startup tasks and Web Administration API.

Publishing Points

Solution contains two predefined publishing points:

·         Push.isml – to receive video stream from encoder

·         Pull.isml – to pull video stream from Upstream Server

Each isml file deployed as part of normal Windows Azure deployment procedure either via management portal or from Visual Studio IDE.

Important: Push/Pull points configuration can be performed by simply editing isml (XML) files in Visual Studio or any other text editor.

Silverlight Player

Solution makes use of sample Silverlight player from site

Below we provide detailed deployment steps.

Pre-deployment steps

Install Visual Studio 2010 Service Pack 1

Solution uses newest ASP.NET MVC3 and Razor technology so SP1 is recommended.

Install Windows Azure Visual Studio Tools

Windows Azure SDK must be installed on local PC to enable creating deployment packages. We recommend installing Visual Studio Tools as well to support direct publishing and debugging from Visual Studio IDE.

Download link:

Important: Check Windows Azure SDK system requirements if you won’t use Web Platform installer

Install Expression Encoder 4 Pro SP1

Expression Encoder 4 Pro SP1 required to deliver Live Smooth Streaming broadcasts. Encoder must be installed on PC with video source connected. (e.g. video capture device, USB camera, etc).

Encoder link:

Important: Pro version required for Live Smooth Streaming and Apple devices support

Download solution source code

Download Visual Studio 2010 solution source code from

Deployment Walkthrough

Load Visual Studio solution

1. Extract downloaded zip file to some location

2. Start Visual Studio in elevated mode (Ctrl+Shift+Click)

3. Open MediaServices.sln from save location

4. Cancel prompt to connect to source control server and then press OK to go offline

5. In next dialog answer No to question to remap Web project URL

6. If project can’t be opened and appears as grey in VS and you plan to run project locally against local IIS with Media Services installed then you must map MediaPortal folder to http://localhost:8080 in IIS Manager

7. If project can’t be opened and appears as grey in VS and you won’t plan to use local IIS Media Services or will change a local IIS url then do the following:

a. Right-Click MediaPortal in Solution Explorer and choose Edit MediaPortal.csproj

b. Find <UseIIS> and change to <UseIIS>False</UseIIS>

c. Find <IISUrl> and change to <IISUrl></IISUrl>

d. Right-Click MediaPortal in Solution Explorer and Reload

8. You should have the following solution loaded in Visual Studio:


Test run project locally

The following steps are optional – it’s just to make sure the solution can run on your PC:

1.       Make sure MediaPortal is a startup project (Right-Click and choose Set as Startup Project)

2.       Open MediaPortal properties page (Double-Click Properties under MediaPortal name)

3.       Choose Web from left-side tabs

4.       Use IIS Express as shown below:


5.       Create Virtual Directory if asked so (change port number if necessary)

6.       Hit F5 – default browser should open with portal loaded similar to below:


Configure Publishing Points

Solution contains two predefined publishing points as shown below:


Push.isml file doesn’t contain any external references and can be left as is.

Pull.isml must be edited to include reference to Upstream Server. Double-click to pull.isml and edit smil/body/switch/ref element as shown below:



Attribute src must contain URL of Push publishing point at Upstream Server such as

Optional Downstream Server configuration

Project web.config file has optional application configuration setting:


    <add key="DownStreamServer" value="" /> <!-- Put http://server here -->



This setting is optional and used in Web portal to identify downstream server. It only defines which URL is shown as a Player URL when user connects to Upstream server Web portal.

Windows Azure Project configuration

Number of Web role instances

Number of instances configured via UI (Double-Click to WindowsAzureProject1-Roles-MediaPortal) or in ServiceConfiguration.cscfg file:

<?xml version="1.0" encoding="utf-8"?>

<ServiceConfiguration serviceName="WindowsAzureProject1" xmlns="" osFamily="2" osVersion="*">

  <Role name="MediaPortal">

    <Instances count="1" />


      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />





Important: Configure only 1 instance of Upstream server. Configure more than 1 instance of Downstream server.


Make sure Web role runs in elevated security context (required to properly configure IIS Media Services):

<?xml version="1.0" encoding="utf-8"?>

<ServiceDefinition name="WindowsAzureProject1" xmlns="">

  <WebRole name="MediaPortal">

    <Runtime executionContext="elevated"></Runtime>


      <Site name="Web">


          <Binding name="Endpoint1" endpointName="Endpoint1" />





      <InputEndpoint name="Endpoint1" protocol="http" port="80" />



      <Import moduleName="Diagnostics" />





Creating Hosted Services

Go to management portal and create two separate deployments. It’s important to have separate DNS for Upstream and Downstream servers. Deployments could be in the same hosted service but be staging and production. Read more about Windows Azure deployments:


For example one could create the following deployments:

· – for Upstream server

· – for Downstream servers

Important: make sure to put hosted services in the same datacenter to avoid unnecessary traffic between Upstream and Downstream servers.

Publishing Solution to Windows Azure

Normal procedure is used to publish solution to Windows Azure. As already mentioned Upstream server must have only 1 Web role instance so change number of instances to 1 for Upstream deployment. After deploying Upstream server change number of instances to >1 and deploy the same solution as downstream server.

Important: Upstream and Downstream solutions are the same. The only difference is number of instances and which publishing point used.

Encoding Live Stream

After solution was successfully published to Windows Azure one can set Encoder to push Live video stream to publishing point. The following is a basic steps required to start encoding session. For more information refer to complete guide at

1.       Start Expression Encoder 4 Pro SP1 and choose Live Broadcasting Project


2.       Add Live Source, choose one of the IIS Smooth Streaming Presets, check “Publishing Point” for output and use as configured before.


3.       Hit Start and start encoding session

Watching Live Stream

Web portal in the solution includes Live Smooth Streaming player which uses the following <object> tag:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480">

               <param name="source" value="/SmoothStreamingPlayer.xap"/>

               <param name="background" value="white" />

               <param name="minRuntimeVersion" value="4.0.50401.0" />

               <param name="autoUpgrade" value="true" />

<param name="InitParams" value="selectedcaptionstream=textstream_eng,mediaurl="/>

               <a href="" style="text-decoration:none">

                      <img src="" alt="Get Microsoft Silverlight" style="border-style:none"/>


           </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>

InitParams must have mediaurl part pointing to either push point at Upstream server (single server deployment) or pull point at Downstream server.

·         For Upstream:

·         For Downstream:

This HTML snippet above could be inserted inside <iframe> at any Web site.

Watch Live Stream from portal

Open one of the deployments (e.g. in browser and:

·         If you at Upstream server as defined by Pull.isml point configuration (that is Upstream server referred in Pull.isml) click on one of the URL under right pointing arrow

·         If you at Downstream server (that is server you’re accessing isn’t referred in Pull.isml) click on one of the URL under left pointing arrow

Portal currently provided readonly configuration experience.


Last edited Jul 18, 2011 at 6:53 PM by DmitriMartynov, version 4


meemee Dec 4, 2012 at 12:40 PM 
Thanks for a good post. When will Azure Media encoder provide encoding to LIVE smooth streaming?

Gorzsi Jul 18, 2011 at 7:20 PM 
Nice work!
I measured 1 minute latency. Is it normal? Can be reduced?