interface WidevineModularDRMConfig {
    LA_URL?: string;
    audioRobustness?: string;
    headers?: HttpHeaders;
    keySystemPriority?: string[];
    licenseRequestRetryDelay?: number;
    maxLicenseRequestRetries?: number;
    mediaKeySystemConfig?: MediaKeySystemConfiguration;
    prepareLicense?: ((licenseObject) => any);
    prepareMessage?: ((keyMessage) => any);
    retryOtherKeysOnForbiddenLicense?: boolean;
    serverCertificate?: ArrayBuffer;
    videoRobustness?: string;
    withCredentials?: boolean;
}

Properties

LA_URL?: string

An URL to the Widevine license server for this content (optional). Can be defined in the configuration or taken out from the video manifest if defined there. If the config URL is defined it has precedence over the URL defined in the manifest.

audioRobustness?: string

Sets the robustness level for audio. The robustness specifies the security level of the DRM key system. If a string specifies a higher security level than the system is able to support playback will fail. The lowest security level is the empty string. The strings are specific to a key system and currently only the values for Widevine are known based on the Chromium source code:

  • SW_SECURE_CRYPTO
  • SW_SECURE_DECODE
  • HW_SECURE_CRYPTO
  • HW_SECURE_DECODE
  • HW_SECURE_ALL
headers?: HttpHeaders

An object which specifies custom HTTP headers.

BuyDRM/KeyOS Specific Example:

headers : {
customdata: 'AUTHENTICATION-XML'
}

DRMtoday by castLabs Specific Example:

headers : {
'dt-custom-data': 'INSERT-YOUR-BASE64-ENCODED-CUSTOMDATA'
}
keySystemPriority?: string[]

Specify the priority of Widevine DRM key system strings for this source. Non-specified strings which the player knows will be put at the end of the list. The first key system string of this list, which is supported on the current platform is used.

Since

8.143.0

licenseRequestRetryDelay?: number

Specifies how long in milliseconds should be waited before a license request should be retried.

maxLicenseRequestRetries?: number

Specifies how often a license request should be retried if was not successful (e.g. the license server was not reachable). Default is 1. 0 disables retries.

mediaKeySystemConfig?: MediaKeySystemConfiguration

An object which allows to specify configuration options of the DRM key system, such as distinctiveIdentifier or persistentState (refer to MediaKeySystemConfiguration for more details). Please note that these settings need to be supported by the browser or playback will fail.

prepareLicense?: ((licenseObject) => any)

A function which gets the widevine license from the server. Is needed for custom widevine servers where not only the license itself is responded, but instead the license is e.g. wrapped in an JSON object.

DRMtoday by castLabs Specific Example:

prepareLicense : (licenseObj) => {
const license = {license: licenseObj.license};

try {
const drmTodayObj = JSON.parse(String.fromCharCode.apply(null, licenseObj.license));
if (drmTodayObj && drmTodayObj.status && drmTodayObj.license) {
if (drmTodayObj.status === 'OK') {
const str = window.atob(drmTodayObj.license);
const bufView = new Uint8Array(new ArrayBuffer(str.length));
for (let i = 0; i < str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
license.license = bufView;
} else {
// license not okay
}
} else {
// no valid DRMtoday license
}
} catch (e) {
// no valid DRMtoday license
}
return license;
};

Type declaration

    • (licenseObject): any
    • Parameters

      • licenseObject: any

      Returns any

prepareMessage?: ((keyMessage) => any)

A function to prepare the license acquisition message which will be sent to the license acquisition server. As many DRM provider expect different, vendor-specific message, this can be done using this user-defined function (optional / depending on the DRM server). The parameter is the key message event object as given by the Widevine Content Decryption Module (CDM).

Default Implementation Example:

prepareMessage : (keyMessage) => {
return keyMessage.message;
}

This will send just the actual key message as provided by the CDM to the license server.

Vualto Specific Example:

prepareMessage : (keyMessage) => {
return JSON.stringify({
token: VUALTO_TOKEN,
drm_info: Array.apply(null, new Uint8Array(keyMessage.message)),
kid: 'VUALTO_KID'
});
}

This will send a JSON object to the license server. This object contains the Vualto-specific token (token), a pre-processed key message (drm_info), and the key ID (kid).

Type declaration

    • (keyMessage): any
    • Parameters

      • keyMessage: any

      Returns any

retryOtherKeysOnForbiddenLicense?: boolean

Specifies the behavior in case the license request fails with a 403 Forbidden error. If set to true, the player will emit a Warning, and try to request a new license for other key IDs, if available. Otherwise, the player will throw an error. Default is false.

serverCertificate?: ArrayBuffer

A server certificate to be used to encrypt messages to the DRM license server. The contents are Key System-specific. It allows an application to proactively provide a server certificate to implementations that support it to avoid the additional round trip, should the Content Decryption Module (CDM) request it. It is intended as an optimization, and applications are not required to use it. If not set but required by the CDM, the CDM will request a certificate from the DRM license server.

videoRobustness?: string

Sets the robustness level for video. The robustness specifies the security level of the DRM key system. If a string specifies a higher security level than the system is able to support playback will fail. The lowest security level is the empty string. The strings are specific to a key system and currently only the values for Widevine are known based on the Chromium source code:

  • SW_SECURE_CRYPTO
  • SW_SECURE_DECODE
  • HW_SECURE_CRYPTO
  • HW_SECURE_DECODE
  • HW_SECURE_ALL
withCredentials?: boolean

Set to true to send credentials such as cookies or authorization headers along with the license requests. Default is false.