Skip to content

Commit 8929b26

Browse files
authored
Merge pull request #1035 from Sipherdrakon/Sipherdrakon-hidive-pssh-fix
Corrected PSSH parsing for manifests with multiple DRM schemes
2 parents cf334d0 + 5e9311a commit 8929b26

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

modules/module.transform-mpd.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,19 @@ export async function parse(manifest: string, language?: LanguageItem, url?: str
153153
['cenc:pssh', 'mspr:pro']
154154
);
155155

156-
if (playlist.contentProtection &&
157-
playlist.contentProtection?.['com.widevine.alpha'].pssh)
158-
pItem.pssh_wvd = arrayBufferToBase64(playlist.contentProtection['com.widevine.alpha'].pssh);
156+
const widevinePssh = extractPSSH(
157+
manifest,
158+
'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',
159+
['cenc:pssh']
160+
);
161+
162+
if (widevinePssh) {
163+
pItem.pssh_wvd = widevinePssh;
164+
}
159165

160-
if (playreadyPssh)
166+
if (playreadyPssh) {
161167
pItem.pssh_prd = playreadyPssh;
168+
}
162169

163170
ret[host].audio.push(pItem);
164171
}
@@ -228,12 +235,19 @@ export async function parse(manifest: string, language?: LanguageItem, url?: str
228235
['cenc:pssh', 'mspr:pro']
229236
);
230237

231-
if (playlist.contentProtection &&
232-
playlist.contentProtection?.['com.widevine.alpha'].pssh)
233-
pItem.pssh_wvd = arrayBufferToBase64(playlist.contentProtection['com.widevine.alpha'].pssh);
238+
const widevinePssh = extractPSSH(
239+
manifest,
240+
'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',
241+
['cenc:pssh']
242+
);
234243

235-
if (playreadyPssh)
244+
if (widevinePssh) {
245+
pItem.pssh_wvd = widevinePssh;
246+
}
247+
248+
if (playreadyPssh) {
236249
pItem.pssh_prd = playreadyPssh;
250+
}
237251

238252
ret[host].video.push(pItem);
239253
}

0 commit comments

Comments
 (0)