File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { hexToArrayBuffer } from '../utils/hex';
44import { convertDataUriToArrayBytes } from '../utils/keysystem-util' ;
55import { logger } from '../utils/logger' ;
66import { KeySystemFormats , parsePlayReadyWRM } from '../utils/mediakeys-helper' ;
7- import { mp4pssh } from '../utils/mp4-tools' ;
7+ import { mp4pssh , parseMultiPssh } from '../utils/mp4-tools' ;
88
99let keyUriToKeyIdMap : { [ uri : string ] : Uint8Array < ArrayBuffer > } = { } ;
1010
@@ -141,7 +141,14 @@ export class LevelKey implements DecryptData {
141141 // the playlist-key before the "encrypted" event. (Comment out to only use "encrypted" path.)
142142 this . pssh = keyBytes ;
143143 // In case of Widevine, if KEYID is not in the playlist, assume only two fields in the pssh KEY tag URI.
144- if ( ! this . keyId && keyBytes . length >= 22 ) {
144+ if ( ! this . keyId ) {
145+ const [ psshData ] = parseMultiPssh ( keyBytes . buffer ) ;
146+ this . keyId =
147+ psshData && 'kids' in psshData && psshData . kids ?. [ 0 ]
148+ ? psshData . kids [ 0 ]
149+ : null ;
150+ }
151+ if ( ! this . keyId ) {
145152 const offset = keyBytes . length - 22 ;
146153 this . keyId = keyBytes . subarray ( offset , offset + 16 ) ;
147154 }
You can’t perform that action at this time.
0 commit comments