Fix bug for non-Widevine EME

This commit is contained in:
FoxRefire 2024-05-07 03:03:54 +09:00
parent 65ef9f2758
commit 8a12fb614e

View File

@ -15,8 +15,11 @@ const originalGenerateRequest = MediaKeySession.prototype.generateRequest;
MediaKeySession.prototype.generateRequest = function(initDataType, initData) {
const result = originalGenerateRequest.call(this, initDataType, initData);
//Get PSSH and pass into content.js
document.dispatchEvent(new CustomEvent('pssh', {
detail: getPssh(initData)
}));
return result;
try {
document.dispatchEvent(new CustomEvent('pssh', {
detail: getPssh(initData)
}));
} finally {
return result;
}
};