DRM protected playback

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:

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 as follows:

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, a token must be added to the source object:

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

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