Skip to main content
Skip table of contents

DRM protected playback

To test this feature and view the example code, please see the  Browsers SDK 1 Example Code Quick Start guide.

Configuring the otvtoolkit plugin for DRM

To enable DRM, add the appropriate parameters to the options object; these will vary for SSP and Conax integrations.

JS
var drmSystem = null;
if (
  window.navigator.userAgent.indexOf("Safari") !== -1 &&
  window.navigator.userAgent.indexOf("Chrome") === -1
) {
  if (fairPlayMode === undefined || fairPlayMode === "nagra-ssp-fps") {
    drmSystem = {
      system: "nagra-ssp-fps",
      config: {
        tenantId: myTenantId,
        licenceServer: fairplayLicenceServerUrl
      }
    };
  } else if (fairPlayMode === "nagra-conax-fps") {
    drmSystem = {
      system: "nagra-conax-fps",
      config: {
        portalURL: conaxPortalUrl,
        certificatesURL: conaxCertificateUrl,
        licenceServer: conaxLicenceServerUrl
      }
    };
  }
} else {
  drmSystem = {
    system: "nagra-ssp",
    config: {
      mode: "token",
      tenantId: myTenantId,
      licenceServer: sspLicenceServerUrl
    }
  };
}

Then initialise the otvtoolkit.

JS
let playerInstance = otvplayer(
    "videoPlayer",
    // options
    {
        plugins: {
            otvtoolkit: {
                drm: drmSystem
            }
        }
    },
    // loaded callback
    function loadedCallback() {
    ...
    }
);

The drm section of the otvtoolkit plugin contains the name of the DRM system (in this case, nagra-ssp, nagra-ssp-fps or nagra-conax) and a system-specific configuration object.

Because the otvtoolkit plugin is configured by the options object, you do not need to initialise the toolkit in loadedCallback().

Adding DRM to the source

The above example configures the player for the token mode of operation for the nagra-ssp DRM system. In this mode, you must add a token to the source object.

JS
source = { src: streamUrl, type: "application/dash+xml", token: streamToken };

The token is an opaque, base64-encoded structure that identifies the content (and it's key) to the DRM system.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.