Using .NET SDK to configure Widevine License delivery with Azure Media Services

This tutorial provides you a step by step guide to configure Widevine licence delivery and Widevine common encryption packaging with MPEG-DASH for streaming your asset. The sample code I provide here will also include PlayReady configuration. Thus, you can deliver a multi-DRM stream to reach multiple browsers. The code repository for this guide is posted here.

1. Upload an asset and encoded it with Multiple-bitrate MP4
2. Create common encryption key and attach it to your asset

3. Configure Asset delivery policy on this asset to include Widevine and PlayReady. By doing so, the Widevine and PlayReady PSSH box will be generated while streaming your asset and your asset will be dynamically encrypted with AES 128 common encryption. From the APIs, a PlayReady and Widevine URL will be generated based on your account information. The License URL and Key ID will be generated in your manifest later while streaming.

4. Add ContentKeyAuthroizationPolicy to your content key. This controls how your license will be issued to a player. We have Open and Token authentications these two ways to authorize the license. I am using open as an example here, however, if you want to use Token restriction, you can check out the AddTokenRestrictedAuthorizationPolicy method in the sample code.

Inside AddOpenAuthorizationPolicy method, you can see there is a line to generate Widevine License requirement.

This CreateWidevineCongigSophisticated will help you compose policies you want to put on an asset. For instance, you can set the license to allow a particular content to be played by setting “can_play=true”. The license request is formatted as a JSON message. And please refer to Widevine Policy documentation for more details.

5. Add the widevine license policies to your contentkeyauthroizationpolicy. When a player requests for content key, the corresponding License will be sent along with policy restrictions.

6. Lastly, after all these configuration, now you could publish your asset by adding a streaming locator. Please remember to have at least one streaming unit so you can dynamically package your stream and deliver via MPEG-DASH.

7. You will be getting a streaming URL looks like this and you can open the manifest by pasting it in IE browser. The highlighted are Widevine specific PSSH box and License URL&Key ID signaled. This is the URL I used: http://nimbusoriginrunnerbnp13.streaming.mediaservices.windows.net/0e7faef5-7707-4206-9479-9e88330931a7/BigBuckBunny.ism/manifest(format=mpd-time-csf).

widevinepackage

8. You can put this stream into Azure Media Player to test it out. AMP will automatically playback your content with PlayReady in IE and Widevine in Chrome. Azure Media Player v1.4.0 supports playback of Azure Media Services content that is dynamically packaged with both PlayReady and Widevine DRM. To get started, check out the documentation, or see the working samples for how to update the player for this configuration through JavaScript and directly through the DOM.

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.