Open alenzalex opened 4 years ago
getCertificate() -----> executed and return success getContentId() -----> executed and return success getLicense() -----> never enters this function
Attaching code snippet that I have tried :
player.ready(function () { player.eme(); var emeOptions = {}
player.src({
src: videSourceUrl,
type: 'application/x-mpegURL',
keySystems: {
'com.apple.fps.1_0': {
getCertificate: function(emeOptions, callback) {
let reqBody = { merchantId: 'myapp_testing' };
videojs.xhr({
uri: 'http://localhost:3080/getCertificate',
method: 'POST',
responseType: 'arraybuffer',
body: JSON.stringify(reqBody),
headers: {
'Content-type': 'application/json'
}
}, function (err, response, responseBody) {
if (err) {
console.log('error in getCertificate')
callback(err);
return;
}
console.log('success in getting Certificate')
callback(null, responseBody);
//var lab = decodeB64ToUint8Array(responseBody.license);
//callback(null, lab);
});
},
getContentId: function(emeOptions, initData) {
console.log('Fairplay: getContentId')
const hostname = getHostnameFromUri(Utf8ArrayToStr(initData))
console.log('Fairplay: getContentId acquired')
return hostname
},
getLicense: function(emeOptions, contentId, keyMessage, callback) {
console.log('Inside getLicense:to proxy')
let reqBody = {
accountId: 'accountId',
videoId: 'videoId',
merchantId: 'myapp_testing'
};
var spcMessage = encodeURIComponent(encodeToB64Uint8Array(keyMessage));
var keySystem = emeOptions.keySystems['com.apple.fps.1_0'];
var options = keySystem.vendor.options;
videojs.xhr({
uri: 'http://localhost:3080/getLicense',
method: 'POST',
responseType: 'text',
body: "spc=" + spcMessage + "&" + contentId,
headers: {
'x-dt-auth-token': options.authToken,
'x-dt-custom-data': normalizeCustomData(options),
'Content-type': 'application/x-www-form-urlencoded'
}
}, function (err, response, responseBody) {
if (err) {
callback(err);
return;
} else {
callback(null, new Uint8Array(responseBody));
}
});
}
}
}
});
});
Safari Version : 13.1
When I play DRM content in safari, I get error as KeySession error: code 6, systemCode 4294924646 with error code as : (CODE:5 MEDIA_ERR_ENCRYPTED)
Then, it displays error as The media playback was aborted due to a corruption problem or because the media used features your browser did not support with error code : (CODE:3 MEDIA_ERR_DECODE)