Playing protected content with DoveRunner Multi-DRM - Web
Overview
Nearly every license provider requires a few special pieces of information to be 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.
Before you begin
The sample code references below contain replace keys which are defined in DoveRunner's HTML5 Player Integration Guide. For the sake of this document, the following replace keys will be utilized:
Replace Key | Description |
---|---|
DASH_MANIFEST_URL | Manifest(mpd) URL of MPEG-DASH content which is encrypted by CENC spec. |
HLS_MANIFEST_URL | Manifest(m3u8) file URL of HLS content which is packaged for FairPlay Streaming (FPS) DRM. |
PALLYCON_LA_URL | License acquisition URL of DoveRunner Cloud. https://drm-license.doverunner.com/ri/licenseManager.do |
PALLYCON_LICENSE_TOKEN | The license token which provides details about the DRM policy session. See DoveRunner's License Token Guide on how to generate one. |
PALLYCON_FPS_CERT_URL | URL for FPS certification data. Returns base64 encoded cert data. |
Widevine
const source = {
dash: 'DASH_MANIFEST_URL',
hls: 'HLS_MANIFEST_URL',
drm: {
widevine: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
},
mediaKeySystemConfig: {
persistentState: 'required',
},
serverCertificate: ''
}
}
};
PlayReady
const source = {
dash: 'DASH_MANIFEST_URL',
hls: 'HLS_MANIFEST_URL',
drm: {
playready: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
}
}
}
};
FairPlay
const source = {
dash: 'DASH_MANIFEST_URL',
hls: 'HLS_MANIFEST_URL',
drm: {
fairplay: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
},
certificateURL: 'PALLYCON_FPS_CERT_URL',
prepareContentId: function (contentId) {
return contentId.substring(contentId.indexOf('skd://') + 6);
},
prepareCertificate: function (rawResponse) {
var responseText = String.fromCharCode.apply(null, new Uint8Array(rawResponse));
var raw = window.atob(responseText);
var rawLength = raw.length;
var certificate = new Uint8Array(new ArrayBuffer(rawLength));
for (var i = 0; i < rawLength; i++)
certificate[i] = raw.charCodeAt(i);
return certificate;
},
useUint16InitData: true
}
}
};
Complete example for Widevine, PlayReady and FairPlay
const source = {
dash: 'DASH_MANIFEST_URL',
hls: 'HLS_MANIFEST_URL',
drm: {
widevine: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
},
mediaKeySystemConfig: {
persistentState: 'required',
},
serverCertificate: ''
},
playready: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
}
},
fairplay: {
LA_URL: 'PALLYCON_LA_URL',
headers: {
'pallycon-customdata-v2' : 'PALLYCON_LICENSE_TOKEN'
},
certificateURL: 'PALLYCON_FPS_CERT_URL',
prepareContentId: function (contentId) {
return contentId.substring(contentId.indexOf('skd://') + 6);
},
prepareCertificate: function (rawResponse) {
var responseText = String.fromCharCode.apply(null, new Uint8Array(rawResponse));
var raw = window.atob(responseText);
var rawLength = raw.length;
var certificate = new Uint8Array(new ArrayBuffer(rawLength));
for (var i = 0; i < rawLength; i++)
certificate[i] = raw.charCodeAt(i);
return certificate;
},
useUint16InitData: true
}
}
};
Updated 9 days ago