fix: enhance response handling in RemoteCDMBase and remoteWidevineCDM classes
This commit is contained in:
		
							parent
							
								
									ee9eeb30ea
								
							
						
					
					
						commit
						37334ae389
					
				@ -291,7 +291,7 @@ class RemoteCDMBase {
 | 
				
			|||||||
        xhr.setRequestHeader("Content-Type", "application/json");
 | 
					        xhr.setRequestHeader("Content-Type", "application/json");
 | 
				
			||||||
        xhr.send(JSON.stringify(body));
 | 
					        xhr.send(JSON.stringify(body));
 | 
				
			||||||
        const jsonData = JSON.parse(xhr.responseText);
 | 
					        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");
 | 
					            logWithPrefix("License response parsed successfully");
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
@ -390,7 +390,7 @@ class remoteWidevineCDM extends RemoteCDMBase {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
        xhr.send(JSON.stringify(body));
 | 
					        xhr.send(JSON.stringify(body));
 | 
				
			||||||
        const jsonData = JSON.parse(xhr.responseText);
 | 
					        const jsonData = JSON.parse(xhr.responseText);
 | 
				
			||||||
        if (jsonData.status === 200) {
 | 
					        if (xhr.status === 200 || jsonData.status === "Success") {
 | 
				
			||||||
            logWithPrefix("Service certificate set successfully");
 | 
					            logWithPrefix("Service certificate set successfully");
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            console.error("Failed to set service certificate:", jsonData.message);
 | 
					            console.error("Failed to set service certificate:", jsonData.message);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user