fix(hls): refuse key tags the DRM of the track cannot decrypt

This commit is contained in:
imSp4rky
2026-11-29 22:07:43 -07:00
parent ba2911056d
commit f0163439d4
5 changed files with 123 additions and 26 deletions
+9 -6
View File
@@ -463,15 +463,18 @@ PlayReady or Widevine. To license such a track through one of those systems:
1. Read the key ID from the init segment of the track. `HLS.get_track_kid_from_init` returns it.
2. Put a DRM object that names the key ID on the track: `drm_stub` from `unshackle.core.drm.cenc`
with `"playready"` or `"widevine"` and the key ID.
with `"playready"` or `"widevine"` and the key ID. When only one of the two systems issues the
content key, also set `track.drm_preference` to it.
3. Let your licence callback send the challenge to the server that issues that key.
`drm_stub` builds the header from the key ID alone, so this works with a licence server that goes
by the key ID, not with one that checks a header a packager signed. When a track carries a DRM
object and every `EXT-X-KEY` of its playlist names a key system unshackle cannot license,
`HLS.drop_unsupported_keys` removes the tags from the parsed playlist. The download then licenses
and decrypts the track with the DRM object of the track. A track with no DRM object still stops
with `None of the key systems are supported`.
by the key ID, not with one that checks a header a packager signed. A platform can issue the
content key of one package of a title and refuse another. When a track carries a Widevine or PlayReady DRM
object and every `EXT-X-KEY` of its playlist is `SAMPLE-AES` or `SAMPLE-AES-CTR` for a key system
unshackle cannot license, `HLS.drop_unsupported_keys` removes the tags from the parsed playlist.
The download then licenses and decrypts the track with the DRM object of the track. This works for
one content key per track: the key changes of the playlist go with the tags. A track with no such
DRM object stops with `None of the key systems are supported` before it downloads a segment.
### How unshackle chooses a CDM and finds keys