Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Properties

Optional LA_URL

LA_URL: undefined | 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.

Optional certificateHeaders

certificateHeaders: HttpHeaders

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

certificateURL

certificateURL: string

The URL to the Fairplay certificate of the license server.

Optional getLicenseServerUrl

getLicenseServerUrl: undefined | function

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”.

Optional headers

headers: HttpHeaders

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

Optional licenseResponseType

licenseResponseType: HttpResponseType

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

Optional maxCertificateRequestRetries

maxCertificateRequestRetries: undefined | 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.

Optional maxLicenseRequestRetries

maxLicenseRequestRetries: undefined | 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.

Optional prepareCertificate

prepareCertificate: undefined | function

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.

param

Optional prepareContentId

prepareContentId: undefined | function

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.

param

Optional prepareLicense

prepareLicense: undefined | function

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.

param

Optional prepareLicenseAsync

prepareLicenseAsync: undefined | function

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.

param

Optional prepareMessage

prepareMessage: undefined | function

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.

param
param

Optional serverCertificate

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

Optional useUint16InitData

useUint16InitData: undefined | false | true

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.

Optional withCredentials

withCredentials: undefined | false | true

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

Generated using TypeDoc