diff --git a/src/controller/eme-controller.ts b/src/controller/eme-controller.ts index a146106c658..54902c85cd2 100644 --- a/src/controller/eme-controller.ts +++ b/src/controller/eme-controller.ts @@ -980,10 +980,17 @@ class EMEController extends Logger implements ComponentAPI { 'buffer' in keyId ? new Uint8Array(keyId.buffer, keyId.byteOffset, keyId.byteLength) : new Uint8Array(keyId); + if ( mediaKeySessionContext.keySystem === KeySystems.PLAYREADY && keyIdArray.length === 16 ) { + // On some devices, the key ID has already been converted for endianness. + // In such cases, this key ID is the one we need to cache. + const originKeyIdWithStatusChange = arrayToHex(keyIdArray); + // Cache the original key IDs to ensure compatibility across all cases. + keyStatuses[originKeyIdWithStatusChange] = status; + changeEndianness(keyIdArray); } const keyIdWithStatusChange = arrayToHex(keyIdArray); @@ -994,6 +1001,7 @@ class EMEController extends Logger implements ComponentAPI { this.log( `key status change "${status}" for keyStatuses keyId: ${keyIdWithStatusChange} key-session "${mediaKeySessionContext.mediaKeysSession.sessionId}"`, ); + keyStatuses[keyIdWithStatusChange] = status; }, );