Playing protected content with DRM.cloud

Overview

Nearly every license provider, including drm.cloud by Insys Video Technologies, requires a few unique parameters to be sent to the DRM license acquisition server. In this case, these parameters are available from Insys Video Technologies Dashboard at videokit.cloud.

Instead of integrating many license providers into the core of the Bitmovin player, we decided to provide necessary configuration options via the player configuration.

Widevine

const source = {
  dash: "DASH_MANIFEST_URL",
  drm: {
    widevine: {
      LA_URL:
        "https://TENANT_CODENAME.la.drm.cloud/acquire-license/widevine?brandGuid=BRAND_ID&userToken=USER_TOKEN",
    },
  },
};

Please replace the following placeholders in the code:

  • DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
  • BRAND_ID: Your brand ID, retrieved from the videokit.cloud dashboard.
  • USER_TOKEN: A JWT token signed with a shared secret that authorises a given license request. More information on how to create JWT User Token available here.
  • TENANT_CODENAME: Tenant name, retrieved from the videokit.cloud dashboard.

Playready

const source = {
  dash: "DASH_MANIFEST_URL",
  drm: {
    playready: {
      LA_URL:
        "https://TENANT_CODENAME.la.drm.cloud/acquire-license/playready?brandGuid=BRAND_ID&userToken=USER_TOKEN",
    },
  },
};

Please replace the following placeholders in the code:

  • DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
  • BRAND_ID: Your brand ID, retrieved from the videokit.cloud dashboard.
  • USER_TOKEN: A JWT token signed with a shared secret that authorises a given license request.
  • TENANT_CODENAME: Tenant name, retrieved from the videokit.cloud dashboard.

Fairplay

const source = {
  hls: "HLS_MANIFEST_URL",
  drm: {
    fairplay: {
      certificateURL:
        "https://TENANT_CODENAME.la.drm.cloud/certificate/fairplay?brandGuid=BRAND_ID",
      headers: {
        "content-type": "application/x-www-form-urlencoded",
        "x-drm-brandGuid": BRAND_ID,
        "x-drm-usertoken": USER_TOKEN,
      },
      prepareContentId: (url) => {
        const serverProcessSPCPath = url
          .substring(1)
          .replace("skd://", "https://");
        const link = document.createElement("a");
        link.href = serverProcessSPCPath;
        return link.hostname;
      },
      prepareMessage: (event, session) => 
        `spc=${encodeURIComponent(event.messageBase64Encoded)}&assetId=${encodeURIComponent(session.contentId)}`,
    },
  },
};

Please replace the following placeholders in the code:

  • HLS_MANIFEST_URL: The URL to the HLS manifest (m3u8) file.
  • BRAND_ID: Your brand ID, retrieved from the videokit.cloud dashboard.
  • USER_TOKEN: A JWT token signed with a shared secret that authorises a given license request.
  • TENANT_CODENAME: Tenant name, retrieved from the videokit.cloud dashboard.

For Fairplay, the License Acquisition URL should be within the HLS Multi-variant manifest.

Complete example for Widevine, PlayReady and FairPlay

const source = {
  dash: "DASH_MANIFEST_URL",
  hls: "HLS_MANIFEST_URL",
  drm: {
    widevine: {
      LA_URL:
        "https://TENANT_CODENAME.la.drm.cloud/acquire-license/widevine?brandGuid=BRAND_ID&userToken=USER_TOKEN",
    },
    playready: {
      LA_URL:
        "https://TENANT_CODENAME.la.drm.cloud/acquire-license/playready?brandGuid=BRAND_ID&userToken=USER_TOKEN",
    },
    fairplay: {
      certificateURL:
        "https://TENANT_CODENAME.la.drm.cloud/certificate/fairplay?brandGuid=BRAND_ID",
      headers: {
        "content-type": "application/x-www-form-urlencoded",
        "x-drm-brandGuid": BRAND_ID,
        "x-drm-usertoken": USER_TOKEN,
      },
      prepareContentId: (url) => {
        const serverProcessSPCPath = url
          .substring(1)
          .replace("skd://", "https://");
        const link = document.createElement("a");
        link.href = serverProcessSPCPath;
        return link.hostname;
      },
      prepareMessage: (event, session) => 
        `spc=${encodeURIComponent(event.messageBase64Encoded)}&assetId=${encodeURIComponent(session.contentId)}`,
    },
  },
};

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.
  • BRAND_ID: Your brand ID, retrieved from the videokit.cloud dashboard.
  • TENANT_CODENAME: Tenant name, retrieved from the videokit.cloud dashboard.
  • USER_TOKEN: A JWT token signed with a shared secret that authorises a given license request.