Playing protected content with EZDRM
Overview
Nearly every license provider, such as Irdeto or EZDRM, requires a few special information being 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.
Widevine
const source = {
dash: 'DASH_MANIFEST_URL',
drm: {
widevine: {
LA_URL: 'http://widevine-dash.ezdrm.com/proxy?pX=EZDRM_ACCOUNT_ID'
}
}
};
Please replace the following placeholders in the code:
- DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
- EZDRM_ACCOUNT_ID: Your EZDRM account ID.
If your setup requires the sending of customData
to the license server, this can be added to the license server URL as well:
const source = {
dash: 'DASH_MANIFEST_URL',
drm: {
widevine: {
LA_URL: 'http://widevine-dash.ezdrm.com/proxy?pX=EZDRM_ACCOUNT_ID&CustomData=BASE64_ENCODED_CUSTOM_DATA'
}
}
};
Please replace the following placeholders in the code:
- DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
- EZDRM_ACCOUNT_ID: Your EZDRM account ID.
- BASE64_ENCODED_CUSTOM_DATA: EZDRM customData to send along with the license request.
PlayReady
const source = {
dash: 'DASH_MANIFEST_URL',
drm: {
playready: {
LA_URL: 'http://playready.ezdrm.com/cency/preauth.aspx?pX=EZDRM_ACCOUNT_ID'
}
}
};
Please replace the following placeholders in the code:
- DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
- EZDRM_ACCOUNT_ID: Your EZDRM account ID.
If your setup requires the sending of customData
to the license server, this can be added to the license server URL as well:
const source = {
dash: 'DASH_MANIFEST_URL',
drm: {
playready: {
LA_URL: 'http://playready.ezdrm.com/cency/preauth.aspx?pX=EZDRM_ACCOUNT_ID&t=BASE64_ENCODED_CUSTOM_DATA'
}
}
};
Please replace the following placeholders in the code:
- DASH_MANIFEST_URL: The URL to the DASH manifest (MPD) file.
- EZDRM_ACCOUNT_ID: Your EZDRM account ID.
- BASE64_ENCODED_CUSTOM_DATA: EZDRM customData to send along with the license request.
FairPlay
const source = {
hls: 'HLS_MANIFEST_URL',
drm: {
fairplay: {
LA_URL: 'http://fps.ezdrm.com/api/licenses/CONTENT_ID',
certificateURL: 'CERTIFICATE_URL',
prepareContentId: (contentId) => {
const uri = contentId;
let uriParts = uri.split('://', 1);
const protocol = uriParts[0].slice(-3);
uriParts = uri.split(';', 2);
contentId = uriParts.length > 1 ? uriParts[1] : '';
uriParts = contentId.split('?', 2);
contentId = uriParts.length > 1 ? uriParts[0] : contentId;
return protocol.toLowerCase() == 'skd' ? contentId : '';
},
prepareLicenseAsync: ckc => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.addEventListener('loadend', () => resolve(new Uint8Array(reader.result)));
reader.addEventListener('error', () => reject(reader.error));
reader.readAsArrayBuffer(ckc);
});
},
prepareMessage: event => new Blob([event.message], {type: 'application/octet-binary'}),
headers: { 'content-type': 'application/octet-stream' },
useUint16InitData: true,
licenseResponseType: 'blob'
}
}
};
Please replace the following placeholders in the code:
- HLS_MANIFEST_URL: The URL to the HLS manifest (M3U8) file.
- CONTENT_ID: The content ID for the given asset, which should be in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
- CERTIFICATE_URL: The URL to the Fairplay certificate. This needs to be accessible for the player.
Complete example for Widevine, PlayReady and FairPlay
const source = {
dash: 'DASH_MANIFEST_URL',
hls: 'HLS_MANIFEST_URL',
drm: {
widevine: {
LA_URL: 'http://widevine-dash.ezdrm.com/proxy?pX=EZDRM_ACCOUNT_ID'
},
playready: {
LA_URL: 'http://playready.ezdrm.com/cency/preauth.aspx?pX=EZDRM_ACCOUNT_ID'
},
fairplay: {
LA_URL: 'http://fps.ezdrm.com/api/licenses/CONTENT_ID',
certificateURL: 'CERTIFICATE_URL',
prepareContentId: (contentId) => {
const uri = contentId;
let uriParts = uri.split('://', 1);
const protocol = uriParts[0].slice(-3);
uriParts = uri.split(';', 2);
contentId = uriParts.length > 1 ? uriParts[1] : '';
uriParts = contentId.split('?', 2);
contentId = uriParts.length > 1 ? uriParts[0] : contentId;
return protocol.toLowerCase() == 'skd' ? contentId : '';
},
prepareLicenseAsync: ckc => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.addEventListener('loadend', () => resolve(new Uint8Array(reader.result)));
reader.addEventListener('error', () => reject(reader.error));
reader.readAsArrayBuffer(ckc);
});
},
prepareMessage: event => new Blob([event.message], {type: 'application/octet-binary'}),
headers: { 'content-type': 'application/octet-stream' },
useUint16InitData: true,
licenseResponseType: 'blob'
}
}
};
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.
- CONTENT_ID: The content ID for the given asset, which should be in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
- CERTIFICATE_URL: The URL to the Fairplay certificate. This needs to be accessible for the player.
- EZDRM_ACCOUNT_ID: Your EZDRM account ID.
Updated 9 months ago