How do I pass a widevide or playready token to the Bitmovin player?

Hi There,

How do I pass a widevide or playready token to the Bitmovin player?
I know how to do it with an AEX token on a HSL like this

    network: {
        preprocessHttpRequest: (type, request) => {
            if (type === bitmovin.player.HttpRequestType.KEY_HLS_AES) {
                request.headers['Authorization'] = 'Bearer ' + aestoken;
            }
            return Promise.resolve(request);
        }

But how to do it with a DASH or a SMOOTH and a widevide or playready token?

I hope somebody can help.

Hi @peter.vanvogelpoel , thanks for your question. There are 2 ways to achieve this.

Hi Goyal,

Thank you for your instruction. But somehow I don’t get it to work. I work with Azure Media Service and below you find a link to make it work in the Azure Media Player. (token valid for 5 days and 50 uses)

Could you paste the right elements in the right place of the setup script for the Bitmovin Player?

Much appreciated.

Peter

Hi @peter.vanvogelpoel , can you please share what issue is encountered when trying above config with Bitmovin player.

Also can you please share a working example from Azure Media player using Widevine? I use a Mac so cannot check PlayReady example soon as that needs to run on Edge browser on a Windows PC for PlayReady to be supported.

Hi Goyal,

Here a working Widevine sample:

The script I’m trying is:

var conf = {
    key: 'xxxx',
    network: {
        preprocessHttpRequest: (type, request) => {
            if (type === bitmovin.player.HttpRequestType.DRM_LICENSE_WIDEVINE) {
                // withCredentials = true
                request.credentials = 'include';
                // custom headers
                request.headers['Authorization'] = 'Bearer ' + widevinetoken;
            }
            return Promise.resolve(request);
        },
    }
};

var source = {
    dash: mediaurl,
};

What I’m getting is:
License request failed
(DRM_FAILED_LICENSE_REQUEST)

Hi Goyal,

I solved it already. I had to take out

request.credentials = ‘include’;

Many thanks for your assistence.

Peter

1 Like

Hi @peter.vanvogelpoel , that’s great to know. You can also try the other configuration of add DRM request headers in the source config as below. This one is more straight forward way of adding headers to license request. If using this, the using preprocessHttpRequest is not required.

    var source = {
      dash: mediaurl,
      drm: {
        widevine: {
          headers: {
            "Authorization" : "<Bearer Token>"
          }
        }        
      } 
    }

Even better. Works like a charm.

Many thanks.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.