Interface AppleFairplayDRMConfig

EZDRM Specific Example:

fairplay: {
LA_URL: 'http://fps.ezdrm.com/api/licenses/YOUR-CONTENT-ID',
certificateURL: 'YOUR-CERTIFICATE',
prepareContentId: (contentId) => {
const uri = contentId;
const uriParts = uri.split('://', 1);
const protocol = uriParts[0].slice(-3);
uriParts = uri.split(';', 2);
contentId = uriParts.length>1?uriParts[1]:'';
return protocol.toLowerCase()=='skd' ? contentId : '';
},
prepareLicenseAsync: (ckc) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.addEventListener('loadend', () => {
const array = new Uint8Array(reader.result);
resolve(array);
});
reader.addEventListener('error', () => {
reject(reader.error);
});
reader.readAsArrayBuffer(ckc);
});
},
prepareMessage: (event, session) => {
return new Blob([event.message], {type: 'application/octet-binary'});
},
headers: {
'content-type': 'application/octet-stream',
},
useUint16InitData: true,
licenseResponseType: 'blob'
}

DRMtoday by castLabs Specific Example:

fairplay: {
LA_URL: 'https://license-server-url-provided-by-drmtoday',
certificateURL: 'https://certificate-url-provided-by-drmtoday',
headers: {
'dt-custom-data': 'INSERT-YOUR-BASE64-ENCODED-CUSTOMDATA',
},
prepareMessage : (event, session) => {
return 'spc=' + encodeURIComponent(event.messageBase64Encoded) + '&' + session.contentId;
},
prepareContentId : (contentId) => {
const pattern='skd://drmtoday?';
let parameters;
let idx = contentId.indexOf(pattern);

if (idx > -1) {
parameters = contentId.substring(idx + pattern.length);
parameters = parameters.replace(/assetid/gi, 'assetId');
parameters = parameters.replace(/variantid/gi, 'variantId');
return parameters;
} else {
return '';
}
}
}

Vualto Specific Example (requires Bitmovin Player 6.0+):

fairplay: {
LA_URL: 'http://fairplay-license.drm.technology/license',
certificateURL: 'http://fairplay-license.drm.technology/certificate',
certificateHeaders: {
'x-vudrm-token': arrayParams['token'],
},
headers: {
'Content-Type': 'application/json',
},
prepareMessage: (keyMessageEvent, keySession) => {
return JSON.stringify({
token: 'VUALTO_TOKEN',
contentId: keySession.contentId,
payload: keyMessageEvent.messageBase64Encoded
});
},
prepareContentId: (rawContentId) => {
const tmp = rawContentId.split('/');
return tmp[tmp.length - 1];
},
prepareCertificate: (cert) => {
return new Uint8Array(cert);
},
prepareLicense: (license) => {
return new Uint8Array(license);
},
licenseResponseType: 'arraybuffer'
}

Hierarchy

  • AppleFairplayDRMConfig

Properties

LA_URL?: string

The URL to the Fairplay 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.

certificateHeaders?: HttpHeaders

An object which specify custom HTTP headers for the certificate request (optional).

certificateURL: string

The URL to the Fairplay certificate of the license server.

getLicenseServerUrl?: ((skdUrl) => string)

Type declaration

    • (skdUrl): string
    • A callback function which gets the URI (without the skd: part) from the HLS manifest passed as parameter. The function needs to return a string which is used as LA_URL “as is”.

      Parameters

      • skdUrl: string

      Returns string

headers?: HttpHeaders

An object which specify custom HTTP headers for the license request (optional).

keySystemPriority?: string[]

Specify the priority of FairPlay 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

licenseResponseType?: HttpResponseType

Sets an explicit response type for the license request. Default response type for this request is TEXT, e.g. EZDRM requires BLOB.

maxCertificateRequestRetries?: number

Specifies how often a certificate request should be retried if was not successful (e.g. the certificate URL returns a 404). Default is 1. 0 disables retries.

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.

prepareCertificate?: ((data) => ArrayBuffer)

Type declaration

    • (data): ArrayBuffer
    • A function to prepare the certificate before passing it into the browser. This is needed if the server response with anything else than the certificate, e.g. if the certificate is wrapped into a JSON object. The server response is passed as parameter “as is” and the return type is expected to be an ArrayBuffer.

      Parameters

      • data: any

      Returns ArrayBuffer

prepareContentId?: ((url) => string)

Type declaration

    • (url): string
    • A function to prepare the contentId, which is sent to the Fairplay license server as request body (optional). As many DRM providers expect different, vendor-specific messages, this can be done using this user-defined function. The parameter is the URI extracted from the HLS manifset (m3u8) and the return value should be the contentID as string.

      Parameters

      • url: string

      Returns string

prepareLicense?: ((data) => string)

Type declaration

    • (data): string
    • A function to prepare the license before passing it into the browser. This is needed if the server response with anything else than the license, e.g. if the license is wrapped into a JSON object. The server response is passed as parameter “as is” and the return type is expected to be a Base64-encoded string.

      Parameters

      • data: any

      Returns string

prepareLicenseAsync?: ((data) => Promise<Uint8Array>)

Type declaration

    • (data): Promise<Uint8Array>
    • Similar to prepareLicense, this callback can be used to prepare the license before passing it to the browser, but the license can be processed asynchronously. Please note that this function must return a promise and the parameter for the resolve function needs to be the Uint8Array, which is passed “as is” to the browser. Using this function prevents prepareLicense from being called.

      Parameters

      • data: any

      Returns Promise<Uint8Array>

prepareMessage?: ((event, session) => any)

Type declaration

    • (event, session): any
    • A function to prepare the license acquisition message which will be sent to the license acquisition server (optional). As many DRM providers expect different, vendor-specific messages, this can be done using this user-defined function. The first parameter is the key message event object as given by the Fairplay Content Decryption Module (CDM), enhanced by the messageBase64Encoded attribute, which contains the key message encoded as base64 encoded string. The second parameter is the ssion object, enhanced by a contentId attribute.

      Parameters

      • event: any
      • session: any

      Returns any

serverCertificate?: ArrayBuffer

Defaults to null, e.g., certificate will be requested from the license server if required. A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.

Since

7.2

useUint16InitData?: boolean

A flag to change between Uint8Array (default, value false) and Uint16Array initialization data. Depends on the fairplay license server, most use Uint8Array but e.g. EZDRM requires Uint16Array.

withCredentials?: boolean

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

Generated using TypeDoc