CONNECT Player SDK 5 for Browsers and Connected TV

Callback mode

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

Browsers and Connected TV SDK 5 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 CONNECT Player SDK handles all this 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 thedrm.configneeds provision of the FairPlay certificate.

JavaScript
plugins: {
    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.

The basic outline of how your requestLicenceCallback function should look is shown below.

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) {
        ...