Callback mode
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.
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.
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 system
- An object with details of the asset to be played back
- The payload of the request message
- Message type (e.g.
license-request
orlicence-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.
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) {
...