How to use DRM License for ExoPlayer in Dash.js or similar

1.2k views Asked by At

I have this customer which asked my a few ago to deliver an Android app for play stream videos. He had the links for the video and the url for the DRM License, which came in a object like this:

    "n": {
    "drm_license_url": "\thttps://sp-supplier.supplier.com/?deviceId=SoMeALphaNUmericakStuFF=",
    "drm_scheme": "widevine",
    "icon": "https://blogger.googleusercontent.com/img/some-logo.png",
    "name": "ANY NAME",
    "uri": "https://supplier-supplier-sl.supplier.com/live/c6eds/VIDEO/SA_Live_dash_enc_2A/SOMEVIDEO.mpd"
  },

I managed to succesful play the videos, after some reading of ExoPlayer library.

Now he wants to also play the same videos on a web, so after some reading I realized that I need to use dash.js or a similar MPD / m3u0 player, which also accept DRM license protection. I had read the documentation for make it, but the issue arised when, in order to pass the DRM license, I have to create this:

var protData = {
        "com.widevine.alpha": {
            "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense",
            "httpRequestHeaders": {
                "X-AxDRM-Message": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU"
            },
            priority: 0
        }

(Source: https://reference.dashif.org/dash.js/latest/samples/drm/widevine.html)

Now, I understand that I have to pass the same Licence URL in the key serverUrl, but about the header, I dont really know which value I must pass to the key X-AxDRM-Message because I does not have that, and neither the customer.

I tried using the pre-built players provided by dash for testing, in which you can choose your params, including DRM License, but Got the following error:

DRM: licenser error! --com.widevine.alpha update, XHR error. status is "" (0), readyState is 4

My questions are:

  • Do I need further information from the DRM supplier in order to run same videos on web?
  • There are any ways to create the protData object with the information that I already have?
  • Can I do this or I´m using the wrong library?

Thanks! Matias

1

There are 1 answers

0
Mick On

The service quite likely requires user authentication and/or a token to be included in the license request.

This functionality is very likely built into the app so it includes the token after authentication. You won't be able to simply copy and paste a license request in this case.

To explore more and verify, Microsoft Azure provides good documentation around DRM integration, not only for its own PlayReady DRM but for Widevine also.

You can see an example of token authentication on their pages:

enter image description here

If you read through the accompanying documentation you can see how the tokens are used in various scenarios: https://learn.microsoft.com/en-us/azure/media-services/previous/media-services-protect-with-playready-widevine