Setup the Bitmovin Player with BuyDRM

If you are not sure what DRM is, you want have an overview and get started, please have a look at our DRM Setup Guide.

Nearly every license provider, such as Irdeto or BuyDRM, requires a few special information being sent to the DRM license server, or responds with a proprietary format. Instead of integrating a few license providers into the core of our player, we decided to provide necessary configuration options via the player configuration.

Widevine

var conf = {
  ...
  source: {
    dash: "DASH_MANIFEST_URL",
    drm: {
      widevine: {
        LA_URL: "http://widevine.licensekeyserver.com",
        headers : [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA";
        }]
      }
    }
  }
};

Please replace the following placeholders in the code:

  • DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
  • BASE64_ENCODED_CUSTOM_DATA: BuyDRM authentication XML in base64 encoded format to send along with the license request.

PlayReady

var conf = {
  ...
  source: {
    dash: "DASH_MANIFEST_URL",
    drm: {
      playready: {
        LA_URL: "http://sldrm.licensekeyserver.com/core/rightsmanager.asmx",
        headers : [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA";
        }]
      }
    }
  }
};

Please replace the following placeholders in the code:

  • DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
  • BASE64_ENCODED_CUSTOM_DATA: BuyDRM authentication XML in base64 encoded format to send along with the license request.

FairPlay

var conf = {
  ...
  source: {
    hls: "HLS_MANIFEST_URL",
    drm: {
      fairplay: {
        LA_URL: "https://fp-keyos.licensekeyserver.com/getkey",
        certificateURL: "CERTIFICATE_URL",
        headers: [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA"
        }],
        prepareMessage : function(event, session) {
          return "spc=" + encodeURIComponent(event.messageBase64Encoded) + "&assetId=" + session.contentId;
        },
        prepareContentId : function(contentId) {
          var idx = contentId.indexOf("skd://");
          if (idx > -1) {
            return contentId.substring(8, 40);
          }
         
          throw "Invalid Content ID format. The format of the Content ID must be the following: skd://xxx where xxx is the Key ID in hex format.";
        }
      }
    }
  }
};

Please replace the following placeholders in the code:

  • HLS_MANIFEST_URL: The URL to the HLS manifest (M3U8) file.
  • BASE64_ENCODED_CUSTOM_DATA: BuyDRM authentication XML in base64 encoded format to send along with the license request.
  • CERTIFICATE_URL: The URL to the FairPlay certificate as provided by BuyDRM

Complete example for Widevine, PlayReady and FairPlay

var conf = {
  ...
  source: {
    dash: "DASH_MANIFEST_URL",
    hls: "HLS_MANIFEST_URL",
    drm: {
      playready: {
        LA_URL: "http://sldrm.licensekeyserver.com/core/rightsmanager.asmx",
        headers : [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA";
        }]
      },
      widevine: {
        LA_URL: "http://widevine.licensekeyserver.com",
        headers : [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA";
        }]
      },
      fairplay: {
        LA_URL: "https://fp-keyos.licensekeyserver.com/getkey",
        certificateURL: "CERTIFICATE_URL",
        headers: [{
          name: "customdata",
          value: "BASE64_ENCODED_CUSTOM_DATA"
        }],
        prepareMessage : function(event, session) {
          return "spc=" + encodeURIComponent(event.messageBase64Encoded) + "&assetId=" + session.contentId;
        },
        prepareContentId : function(contentId) {
          var idx = contentId.indexOf("skd://");
          if (idx > -1) {
            return contentId.substring(8, 40);
          }
         
          throw "Invalid Content ID format. The format of the Content ID must be the following: skd://xxx where xxx is the Key ID in hex format.";
        }
      }
    }
  }
};

Please replace the following placeholders in the code:

  • DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
  • HLS_MANIFEST_URL: The URL to the HLS manifest (M3U8) file.
  • BASE64_ENCODED_CUSTOM_DATA: BuyDRM authentication XML in base64 encoded format to send along with the license request.
  • CERTIFICATE_URL: The URL to the FairPlay certificate as provided by BuyDRM
Back to Top
Simple Share Buttons