Skip to content

Commit 6238bc8

Browse files
authored
Fix issue where some devices not works with playready (#7631)
1 parent c535751 commit 6238bc8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/controller/eme-controller.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,10 +980,17 @@ class EMEController extends Logger implements ComponentAPI {
980980
'buffer' in keyId
981981
? new Uint8Array(keyId.buffer, keyId.byteOffset, keyId.byteLength)
982982
: new Uint8Array(keyId);
983+
983984
if (
984985
mediaKeySessionContext.keySystem === KeySystems.PLAYREADY &&
985986
keyIdArray.length === 16
986987
) {
988+
// On some devices, the key ID has already been converted for endianness.
989+
// In such cases, this key ID is the one we need to cache.
990+
const originKeyIdWithStatusChange = arrayToHex(keyIdArray);
991+
// Cache the original key IDs to ensure compatibility across all cases.
992+
keyStatuses[originKeyIdWithStatusChange] = status;
993+
987994
changeEndianness(keyIdArray);
988995
}
989996
const keyIdWithStatusChange = arrayToHex(keyIdArray);
@@ -994,6 +1001,7 @@ class EMEController extends Logger implements ComponentAPI {
9941001
this.log(
9951002
`key status change "${status}" for keyStatuses keyId: ${keyIdWithStatusChange} key-session "${mediaKeySessionContext.mediaKeysSession.sessionId}"`,
9961003
);
1004+
9971005
keyStatuses[keyIdWithStatusChange] = status;
9981006
},
9991007
);

0 commit comments

Comments
 (0)