Tuesday, May 14, 2013

Live Streaming with IIS Media Services - Depoyment Scenarios

 
In this blog I will try to explain how to deploy and setup the IIS Live Streaming on Cloud and also talk about couple of techniques and strategies for a real time Live Streaming deployment.
 
You can refer the first part of the blog on this link http://livestreamingwithiis.blogspot.in/.
 
How to deploy Media Service & configure Live Streaming Client on Cloud:
 
Note: By default IIS Media Service is not installed on the Cloud Instance


 

  • Create a new cloud template project and select an ASP.NET Web Role/MVC based Web Role
 

 
 

* this will be used to view the live streaming on the html page
  • Add “IISMedia64.msi” to your Web Role project
 

 
  • Create a “startup.cmd” batch file which will execute the IISMedia package
 

 

 

 

 

Code Snippet for “startup.cmd”

set msiexec=%systemroot%\system32\msiexec.exe

 

set appcmd=%systemroot%\system32\inetsrv\appcmd.exe

 

%msiexec% /i "%~dp0\IISMedia64.msi" /qn ADDLOCAL=ALL /Le startup_media.txt
 
 
  • Add a startup task in the “ServiceDefinition.csdef” file which will execute and deploy the IIS media package on the Cloud Instance
 

Code Snippet:

<Startup>

      <Task commandLine="startup.cmd" executionContext="elevated">

      </Task>

</Startup>

 
  • Build the solution and upload it to the Cloud Service
 

 
  • Once publish is successfully completed, Remote Login to the instance and configure the IIS Media Service as done in section Configure IIS Media Services
 

 
  • Provide the publish endpoint to the Expression Encoder in the format http://<name>.cloudapp.net/<name>.isml and click Start
 

 
  • Go to the url http://<name>.cloudapp.net/SmoothStreamingPlayer.html and you can see the live streaming working

 

 

Building Scalable and Robust Live Smooth Streaming Server Solutions
 

PUSH and PULL Concepts:

 
PUSH Input Stream:
This push input is for accepting long running live streams from a push source which uses HTTP POST requests to push data into the server. A push source can be a group of live encoders or another Live Smooth Streaming publishing point. The more common usage of push input stream is to ingest live stream from Live Smooth Streaming encoders which typically supports push outputs.
As we have seen in "Configure IIS Media Services" section it follows PUSH model where we configured a Server in PUSH mode which will receive the Encoding Packets and can also show the live fragments.
 
 
PUSH Output Stream:
Push output stream means that the publishing point, upon being started or receiving new incoming streams, pushes the same long running fragmented MP4 streams to other publishing points using HTTP POST requests. Push output stream is often used to fan out encoder streams among the servers and provide redundancy in failover scenarios. To configure push output streams, you just need to set it up on the publishing point settings

 
 
PULL Input Stream:
Pull Input Stream is normally used in server to server distribution to scale out the streams. It could also be used to ingest live streams from the encoder if the encoder supports pulling. When configured with pull input stream, the server will issue HTTP GET requests to upstream servers to pull down the long running fragmented MP4 streams. A typical usage of Pull Input Stream is on distribution servers which source from origin servers. The distribution server can offload manifest creation, file archiving and client request serving from the origin server. The distribution server knows how to sync up with the origin server to provide full access to all the live contents to the clients.

One publishing point can only be pulling from a single source publishing point at a time. The additional URLs you enter will become the backup URLs. If the current connection gets broken, server will do a limited number of retries using the current URL. If all retries with the current URL failed, server will then try the backup URLs one by one until it succeeds.
 
 


Distribution Server using Pull Input Streams
PULL Output Stream:

Pull Output Stream is simply to enable downstream servers to pull from the current one. It’s the same "Allow server connections" checkbox that enables both push and pull output stream option. Since the sever will be waiting for downstream requests for pulling, there is no other settings to be configured
 
 
Putting it all together:

Ok, so we’ve gone through all the possible inputs and outputs and their functionalities. Now let’s take a look at an IIS Live Smooth Streaming server solution as an example and see how these inputs and outputs work.

This is a topology which was been used for some live event deployments. There are five layers in this diagram: encoder, ingest, origin, distribution and client. The solid lines are the normal data flow path while the dotted lines are the backup/failover paths.
 


 

No comments:

Post a Comment