CONNECT Player SDK 1 for Browsers

Callback mode

To test this feature and view the example code, please see the 

Browsers SDK 1 Example Code Quick Start

guide.

To define custom actions during DRM licence acquisition, you can initialise the otvtoolkit in callback mode.

This is an alternative form of integrating DRM to providing details of the system with subsequent licenceServer and tenantId attributes. Here the SDK handles this all with a finite set of DRM systems and modes of operation, which allows much greater flexibility.

Configuration

Indicate the system as "customer" and provide configuration of requestLicenceCallback as a function that will be triggered when DRM licencing is acquired ahead of playback.

JavaScript
plugins: {
    otvtoolkit: {
        drm: {
            system: "customer",
            config: {
                requestLicenceCallback: myLicenceRetrievalFunction
            }
        }
    }
}

Adaption for FPS

A small variation from the above is required for FairPlay in the Safari browser. Here the drm.config needs provision of the FairPlay certificate.

JavaScript
ins: {
    otvtoolkit: {
        drm: {
            system: "customer",
            config: {
                fairplayServerCertificate: certificate,
                requestLicenceCallback: myLicenceRetrievalFunction
            }
        }
    }
}

Requirements of your implementation

The requestLicenceCallback function defined must:

  • Accept arguments where the following can be provided:Key systemAn object with details of the asset to be played backThe payload of the request messageMessage type (e.g. license-request or licence-renewal)

  • Return a Promise which will resolve on the completion of the delivery of the message.

See below for the basic outline of how your requestLicenceCallback function should look.

JavaScript
function myLicenceRetrievalFunction(keySystem, source, requestPayload, messageType) {
   var url;
   var headers;
 
   if (messageType === "license-renewal") {
       ...
   } else {
       ...
   }
 
   if (keySystem === "com.widevine.alpha") {
       ...
   } else if (keySystem === "com.microsoft.playready") {
       ...
   } else {
       ...
   }
   return new Promise(function resolver(resolve, reject) {
       ...