Skip to content

Commit 8db1251

Browse files
committed
Address feedback
1 parent b8d3cc8 commit 8db1251

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/controller/eme-controller.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -981,13 +981,16 @@ class EMEController extends Logger implements ComponentAPI {
981981
? new Uint8Array(keyId.buffer, keyId.byteOffset, keyId.byteLength)
982982
: new Uint8Array(keyId);
983983

984-
// On some devices, the key ID has already been converted for endianness.
985-
// In such cases, this key ID is the one we need to cache.
986-
const originKeyIdWithStatusChange = arrayToHex(keyIdArray);
987984
if (
988985
mediaKeySessionContext.keySystem === KeySystems.PLAYREADY &&
989986
keyIdArray.length === 16
990987
) {
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+
991994
changeEndianness(keyIdArray);
992995
}
993996
const keyIdWithStatusChange = arrayToHex(keyIdArray);
@@ -999,9 +1002,7 @@ class EMEController extends Logger implements ComponentAPI {
9991002
`key status change "${status}" for keyStatuses keyId: ${keyIdWithStatusChange} key-session "${mediaKeySessionContext.mediaKeysSession.sessionId}"`,
10001003
);
10011004

1002-
// Cache both the original and endianness-converted key IDs to ensure compatibility across all cases.
10031005
keyStatuses[keyIdWithStatusChange] = status;
1004-
keyStatuses[originKeyIdWithStatusChange] = status;
10051006
},
10061007
);
10071008
return keyStatuses;

0 commit comments

Comments
 (0)