Default DRM integration

Overview

Bradmax player supports default integration DRM providers, which is quite common. Setting "provider": “default” in DRM config will be required.

Your web server has to generate Authentication XML for user, who need access to selected media. It will be used as “pass” for License server for obtaining license. With this license, player will be able to decode encrypted video.

Configuration

For correct playback player needs:

  • Authentication XML encoded as base64 string
  • PlayReady license server URL
  • Widevine license server URL
  • FairPlay license server URL
  • FairPlay license server certificate URL.

DRM configuration object

You need to prepare drm configuration object and set it for each media source object . Each media source points to single HLS, MPEG-DASH, MSSmoothStreaming stream. drm object specification:

Field nameTypeDescription
providerstringKey defining provider. Should be “default”.
playreadyobjectPlayReady configuration object. See keys below.
playready.laUrlstringURL address for PlayReady license server.
playready.customDatastringAuthentication XML encoded as base64 string.
widevineobjectWidevine configuration object. See keys below.
widevine.laUrlstringURL address for Widevine license server.
widevine.customDatastringAuthentication XML encoded as base64 string.
widevine.audioRobustnessstringRobustness level for DRM. Default: SW_SECURE_CRYPTO
widevine.videoRobustnessstringRobustness level for DRM. Default: SW_SECURE_CRYPTO
fairplayobjectFairPlay configuration object. See keys below.
fairplay.laUrlstringURL address for FairPlay license server.
fairplay.certUrlstringURL address for FairPlay license server certificate.
fairplay.customDatastringAuthentication XML encoded as base64 string.

Example

// DRM configuration.
var authenticationXmlBase64Encoded = "PEtleU9TQXV0aGVudGljYXRpb25YTUw+PERhdGE+PEdlbmVyYXRpb25UaW1lPjIwMTYtMTEtMTkgMDk6MzQ6MDEuOTkyPC9HZW5lcmF0aW9uVGltZT48RXhwaXJhdGlvblRpbWU+MjAyNi0xMS0xOSAwOTozNDowMS45OTI8L0V4cGlyYXRpb25UaW1lPjxVbmlxdWVJZD4wZmZmMTk3YWQzMzQ0ZTMyOWU0MTA0OTIwMmQ5M2VlYzwvVW5pcXVlSWQ+PFJTQVB1YktleUlkPjdlMTE0MDBjN2RjY2QyOWQwMTc0YzY3NDM5N2Q5OWRkPC9SU0FQdWJLZXlJZD48V2lkZXZpbmVQb2xpY3kgZmxfQ2FuUGxheT0idHJ1ZSIgZmxfQ2FuUGVyc2lzdD0iZmFsc2UiIC8+PFdpZGV2aW5lQ29udGVudEtleVNwZWMgVHJhY2tUeXBlPSJIRCI+PFNlY3VyaXR5TGV2ZWw+MTwvU2VjdXJpdHlMZXZlbD48L1dpZGV2aW5lQ29udGVudEtleVNwZWM+PEZhaXJQbGF5UG9saWN5IC8+PExpY2Vuc2UgdHlwZT0ic2ltcGxlIiAvPjwvRGF0YT48U2lnbmF0dXJlPk1sNnhkcU5xc1VNalNuMDdicU8wME15bHhVZUZpeERXSHB5WjhLWElBYlAwOE9nN3dnRUFvMTlYK1c3MDJOdytRdmEzNFR0eDQydTlDUlJPU1NnREQzZTM4aXE1RHREcW9HelcwS2w2a0JLTWxHejhZZGRZOWhNWmpPTGJkNFVkRnJUbmxxU21raC9CWnNjSFljSmdaUm5DcUZIbGI1Y0p0cDU1QjN4QmtxMUREZUEydnJUNEVVcVJiM3YyV1NueUhGeVZqWDhCR3o0ZWFwZmVFeDlxSitKbWI3dUt3VjNqVXN2Y0Fab1ozSHh4QzU3WTlySzRqdk9Wc1I0QUd6UDlCc3pYSXhKd1ZSZEk3RXRoMjhZNXVEQUVZVi9hZXRxdWZiSXIrNVZOaE9yQ2JIVjhrR2praDhHRE43dC9nYWh6OWhVeUdOaXRqY2NCekJvZHRnaXdSUT09PC9TaWduYXR1cmU+PC9LZXlPU0F1dGhlbnRpY2F0aW9uWE1MPg==";
var drmConfig = {
    "provider": "default",
    "playready": {
        "laUrl": "https://drm-playready.example.com/rightsmanager.asmx",
        "customData": authenticationXmlBase64Encoded
    },
    "widevine": {
        "laUrl": "https://drm-widevine.example.com/getkey",
        "customData": authenticationXmlBase64Encoded
    },
    "fairplay": {
        "laUrl": "https://drm-fairplay.example.com/getkey",
        "customData": authenticationXmlBase64Encoded,
        "certUrl": "https://drm-fairplay.example.com/cert/server-cert.der"
    }
};

// Setting DRM configuration into player dataProvider object.
var options = {
    "dataProvider": {
        "source": [
            {
                "url": "https://cdn.example.com/g180-avc_a2.0-vbr-aac-128k/r30/dash-wv-pr/stream.mpd",
                "drm": drmConfig
            },
            {
                "url": "https://cdn.example.com/g180-avc_a2.0-vbr-aac-128k/r30/hls-fp/master.m3u8",
                "drm": drmConfig
            }
        ],
        "duration": 718,
        "title": "DRM Demo",
        "splashImages": [
            {
                "url": "https://example.com/startsplash.jpg"
            }
        ]
    }
};
var element = document.getElementById("player");
window.bradmax.player.create(element, options);