fix: enhance response handling in RemoteCDMBase and remoteWidevineCDM classes

This commit is contained in:
voldemort 2025-07-24 17:57:28 +07:00
parent ee9eeb30ea
commit 37334ae389

View File

@ -291,7 +291,7 @@ class RemoteCDMBase {
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(body));
const jsonData = JSON.parse(xhr.responseText);
if (jsonData.status === 200 || jsonData.message?.includes("parsed and loaded")) {
if (xhr.status === 200 || jsonData.status === "Success" || jsonData.message?.includes("parsed and loaded")) {
logWithPrefix("License response parsed successfully");
return true;
} else {
@ -390,7 +390,7 @@ class remoteWidevineCDM extends RemoteCDMBase {
};
xhr.send(JSON.stringify(body));
const jsonData = JSON.parse(xhr.responseText);
if (jsonData.status === 200) {
if (xhr.status === 200 || jsonData.status === "Success") {
logWithPrefix("Service certificate set successfully");
} else {
console.error("Failed to set service certificate:", jsonData.message);