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: function(contentId) {
    var uri = contentId;
    var uriParts = uri.split('://', 1);
    var protocol = uriParts[0].slice(-3);
    uriParts = uri.split(';', 2);
    contentId = uriParts.length>1?uriParts[1]:'';
    return protocol.toLowerCase()=='skd'?contentId:'';
  },
  prepareLicenseAsync: function(ckc) {
    return new Promise(function(resolve, reject) {
      var reader = new FileReader();
      reader.addEventListener('loadend', function() {
        var array = new Uint8Array(reader.result);
        resolve(array);
      });
      reader.addEventListener('error', function() {
        reject(reader.error);
      });
      reader.readAsArrayBuffer(ckc);
    });
  },
  prepareMessage: function(event, session) {
    return new Blob([event.message], {type: 'application/octet-binary'});
  },
  headers: [{
    name: 'content-type',
    value: '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: [{
    name: 'dt-custom-data',
    value: 'INSERT-YOUR-BASE64-ENCODED-CUSTOMDATA'
  }],
  prepareMessage : function(event, session) {
    return 'spc=' + encodeURIComponent(event.messageBase64Encoded) + '&' + session.contentId;
  },
  prepareContentId : function(contentId) {
    var pattern='skd://drmtoday?';
    var parameters;
    var idx;

    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: [{
    name: 'x-vudrm-token',
    value: arrayParams['token']
  }],
  headers: [{
    name: 'Content-Type',
    value: 'application/json'
  }],
  prepareMessage: function (keyMessageEvent, keySession) {
    return JSON.stringify({
      token: 'VUALTO_TOKEN',
      contentId: keySession.contentId,
      payload: keyMessageEvent.messageBase64Encoded
    });
  },
  prepareContentId: function(rawContentId) {
    var tmp = rawContentId.split('/');
    return tmp[tmp.length - 1];
  },
  prepareCertificate: function(cert) {
    return new Uint8Array(cert);
  },
  prepareLicense: function(license) {
    return new Uint8Array(license);
  },
  licenseResponseType: 'arraybuffer'
}

Hierarchy

  • AppleFairplayDRMConfig

Index

Properties

LA_URL

LA_URL: string

The URL to the Fairplay license server for this content.

Optional certificateHeaders

certificateHeaders: Header[]

An array of objects 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: 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”.

Type declaration

    • (skdUrl: string): string
    • Parameters

      • skdUrl: string

      Returns string

Optional headers

headers: Header[]

An array of objects 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: 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: 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: 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

Type declaration

    • (data: any): ArrayBuffer
    • Parameters

      • data: any

      Returns ArrayBuffer

Optional prepareContentId

prepareContentId: 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

Type declaration

    • (url: string): string
    • Parameters

      • url: string

      Returns string

Optional prepareLicense

prepareLicense: 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

Type declaration

    • (data: any): string
    • Parameters

      • data: any

      Returns string

Optional prepareLicenseAsync

prepareLicenseAsync: 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

Type declaration

    • (data: any): Promise<Uint8Array>
    • Parameters

      • data: any

      Returns Promise<Uint8Array>

Optional prepareMessage

prepareMessage: 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

Type declaration

    • (event: any, session: any): any
    • Parameters

      • event: any
      • session: any

      Returns any

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

Optional withCredentials

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