Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Using Node.js for Azure Media Services/Handling Media Upload and Streaming

Using Node.js for Azure Media Services/Handling Media Upload and Streaming

Problem

I am in the middle of developing services that will deal with Media files (audio/video) . These services are responsible for uploading and then streaming media files uploaded by client (IOS, Android but not limited to these devices/platforms).

We are using node.js with mongodb as database. In the near future our services will be part of Azure. (Portions of our backend are already there in Azure)

In that case i came across Azure Media Services. I know that it does't have any sdk to work with for Node.js so my only option here is to use REST Service from Azure Media Services.

My question are:

1) Whats the correct approach adapted in this scenario by developers already handling this scenario. I am open for approaches/practices here and change what i am planning to do currently.

2)If i use Azure Media Services. How would my client calls my services (node.js) which acts as a proxy for calling REST Services for Azure Media Services. How will this exactly work and i have file in hand in my proxy to re-upload. Or i will internally direct my services so that internally it uploads to Media Services .

3)How these media files uploaded in media services are related to a record in MongoDB. Like a record can have multiple media files.

I appreciate any pointers/explanations here.

Thanks,

Problem courtesy of: Tabish

Solution

To proper answer your question there are few questions need to be answered.

1.What functionality are you going to provide on top of azure media services. From your question it seems that main goal to let users to upload asset and them to have ability to stream uploaded content.

For this purpose you need to have following steps to be implemented in node js.

  • Create asset and asset files records in Azure Media Service(WAMS) by calling REST API. http://msdn.microsoft.com/en-us/library/windowsazure/hh973617.aspx
  • Create access policy and locator which will give URI of blob storage where file needs to be uploaded. WAMS REST API
  • Upload file using node.js to blob storage http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/blob-storage/
  • Create encoding job which will encode you input into multi bitrate mp4. WAMS REST API
  • Package your multi bitrate mp4 to smooth or HLS format or utilize dinamic packaging feature in WAMs. http://channel9.msdn.com/Series/Windows-Azure-Media-Services-Tutorials/Introduction-to-dynamic-packaging
    • Once you ready to stream your content you need to give user client playback url pointing to origin server. In order to do this you have to call WAMS REST API and create origin locator

Assets are exposing ID and AlternativeID properties which you can use to map your metadata about content with WAMS assets and implement any additional Content Management logic.

You need to act as proxy if you have some user based authentication and don't want to have dedicate separate azure media account to one user. WAMS provides basic blocks for asset ingest, encode, package, ondemand delivery and in nearest future for live streaming.

It can be used as foundation for your cms system or you can act SSAS provider by adding additional authentication, authorization layer. Currently you can use third party offerings http://www.ezdrm.com/ for playback DRM protection or your own license server http://msdn.microsoft.com/en-us/library/windowsazure/dn223278.aspx.

Solution courtesy of: George Trifonov

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Using Node.js for Azure Media Services/Handling Media Upload and Streaming

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×