fix(hls): take the key id from EXT-X-KEY when the PSSH carries none

This commit is contained in:
imSp4rky
2026-08-11 21:24:05 -06:00
parent 356d6fb984
commit b5e1c3e6a7
+7 -1
View File
@@ -1288,9 +1288,15 @@ class HLS:
elif key.method == "ISO-23001-7":
drm = Widevine(pssh=WV_PSSH.new(key_ids=[key.uri.split(",")[-1]], system_id=WV_PSSH.SystemId.Widevine))
elif key.keyformat and key.keyformat.lower() == WidevineCdm.urn:
extra_params = dict(key._extra_params) # noqa
# a v0 PSSH carries no KID, leaving the tag's own KEYID as the only source
kid = extra_params.pop("keyid", None) or extra_params.pop("kid", None)
if isinstance(kid, str):
kid = kid.removeprefix("0x").removeprefix("0X")
drm = Widevine(
pssh=WV_PSSH(key.uri.split(",")[-1]),
**key._extra_params, # noqa
kid=kid,
**extra_params,
)
elif key.keyformat and key.keyformat.lower() in {f"urn:uuid:{PR_PSSH.SYSTEM_ID}", "com.microsoft.playready"}:
drm = PlayReady(