From 8a12fb614e38eb83805bbc949f17ba8c718dec13 Mon Sep 17 00:00:00 2001 From: FoxRefire <155989196+FoxRefire@users.noreply.github.com> Date: Tue, 7 May 2024 03:03:54 +0900 Subject: [PATCH] Fix bug for non-Widevine EME --- inject.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inject.js b/inject.js index 9b09ef2..4f8127d 100644 --- a/inject.js +++ b/inject.js @@ -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; + } };