Getting keySystemNoAccess error for FairPlay DRM #6214
-
I'm trying to configure my player to work with FairPlay drm'd content. I keep getting a I'm working with Accurate Player hls player ^8.2.0 in an Angular application. Widevine is working for Google Chrome and Firefox with no issue but the same content won't play in Safari. (Testing with Safari 16.6). I added the licenseXhrSetup and the licenseResponseCallback config options to the hlsconfig but so far I haven't gotten to a solution. There were also some functions in the docs that didn't exist in his.js when I tried adding them to my project (ex `settings: Partial = {
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
How you format the license request payload and transform the response depend on your license server. Contact the DRM provider and ask how to setup HLS.js, if they don't know, they should be filing an issue with the project and working with us to establish examples that you can get from their site.
You need to provide your own functions for converting data formats. Those requirements are not on HLS.js but on the license server implementation for not providing a response in the format that EME expects. Here's an example of what the setup looks like for AWS: {
emeEnabled: true,
drmSystems: {
'com.apple.fps': {
licenseUrl: 'https://fairplay-license',
serverCertificateUrl:
'https://fairplay-cert',
},
'com.widevine.alpha': {
licenseUrl:
'https://widevine-license',
},
'com.microsoft.playready': {
licenseUrl:
'https://playready-license',
},
},
licenseXhrSetup(xhr, url, keyContext, licenseChallenge) {
const keySystem = keyContext.keySystem;
const uri = keyContext.decryptdata?.uri;
const keyId = keyContext.decryptdata?.keyId;
if (keySystem === 'com.apple.fps') {
xhr.responseType = 'text';
}
xhr.open('POST', url, true);
xhr.setRequestHeader(
'x-dt-custom-data',
'GET THIS FROM AWS',
);
return licenseChallenge;
},
licenseResponseCallback(xhr, url, keyContext) {
const keySystem = keyContext.keySystem;
const response = xhr.response;
if (keySystem === 'com.apple.fps') {
const base64Decode = (base64encodedStr) =>
Uint8Array.from(atob(base64encodedStr), (c) => c.charCodeAt(0));
const data = base64Decode(xhr.response);
return data.buffer;
}
return response;
},
} Some platforms might require a |
Beta Was this translation helpful? Give feedback.
-
I was able to find a solution to my problem. First, I removed the robustness as Rob suggested. According to Shaka Player DRM configuration, Apple's Documentation states the robustness should be an empty string. Secondly, the Irdeto service providing me with the DRM key was expecting requestMediaKeySystemAccessFunc: (keySystem, supportedConfigurations) => {
if (keySystem === 'com.apple.fps') {
// @ts-ignore
keySystem = 'com.apple.fps.1_0';
}
return navigator.requestMediaKeySystemAccess(keySystem, supportedConfigurations);
} I also updating the license xhr setup to match what my service was expecting and changed the keySystem in the licenseResponseCallback to In the end, my hls configuration looked like this let settings: Partial<HlsPlayerSettings> = {
hlsConfig: {
emeEnabled: true,
licenseXhrSetup: this.drmType === 'FAIRPLAY'
? function (xhr, url, keyContext, licenseChallenge) {
// @ts-ignore
const keyId = keyContext.decryptdata?.uri.match(/keyId=([^&]+)/i)[1] || '';
// @ts-ignore
const contentId = keyContext.decryptdata?.uri.match(/contentId=([^&]+)/i)[1] || '';
const licenseUrl = `${url}&contentId=${contentId}&keyId=${keyId}`
xhr.open('POST', licenseUrl, true)
xhr.responseType = 'blob';
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
return licenseChallenge;
} : undefined,
licenseResponseCallback: this.drmType === 'FAIRPLAY'
? function(xhr, url, keyContext) {
// @ts-ignore
keyContext.keySystem = 'com.apple.fps.1_0';
return xhr.response.arrayBuffer();
} : undefined,
drmSystems: {
'com.widevine.alpha': {
licenseUrl: this.drmKeySystems?.WIDEVINE.url || ''
},
'com.microsoft.playready': {
licenseUrl: this.drmKeySystems?.PLAYREADY.url || ''
},
'com.apple.fps': {
licenseUrl: this.drmKeySystems?.FAIRPLAY.url || '',
serverCertificateUrl: this.drmKeySystems?.FAIRPLAY.certificateURL || ''
}
},
requestMediaKeySystemAccessFunc: (keySystem, supportedConfigurations) => {
if (keySystem === 'com.apple.fps') {
// @ts-ignore
keySystem = 'com.apple.fps.1_0';
}
return navigator.requestMediaKeySystemAccess(keySystem, supportedConfigurations);
}
}
} With this config, I was able to get Fairplay and Widevine working. |
Beta Was this translation helpful? Give feedback.
I was able to find a solution to my problem.
First, I removed the robustness as Rob suggested. According to Shaka Player DRM configuration, Apple's Documentation states the robustness should be an empty string.
Secondly, the Irdeto service providing me with the DRM key was expecting
com.apple.fps.1_0
while HLS was expectingcom.apple.fps
. To work around this, I added a mapping to therequestMediaKeySystemAccessFunc
I also updating…