fix(hls): bridge a stitched one-key FairPlay playlist with an all-zero tenc KID

This commit is contained in:
imSp4rky
2026-12-01 17:03:56 -07:00
parent 90ab0ca4cb
commit f680df7eff
4 changed files with 267 additions and 22 deletions
+5 -3
View File
@@ -486,8 +486,9 @@ these conditions are true:
unshackle cannot license.
- The configured CDM is a PlayReady or Widevine CDM.
- The init segment (`EXT-X-MAP`) of the track names a key ID in its `tenc` box. When the `tenc` key ID is all
zeros, its `pssh` boxes must name exactly one key ID, and the encrypted segments must have one init
segment and the playlist one key URI. MPEG-TS media has no init segment.
zeros, the playlist must have one key URI, and each init segment under the key tag must give the same
key ID: its `tenc` key ID, or else the one key ID that its `pssh` boxes name. A clear init segment,
such as the one of a clear lead or tail, does not count. MPEG-TS media has no init segment.
- The init segment does not change without an `EXT-X-DISCONTINUITY`.
The download reads the key ID from the init segment, builds a DRM object for the DRM system of the
@@ -498,7 +499,8 @@ licence that gives no content key stops the track before it downloads a segment.
A service that must choose the DRM system itself, or one that knows the key ID, puts the DRM object
on the track:
1. Read the key ID from the init segment of the track. `HLS.get_track_kid_from_init` returns it.
1. Read the key ID from the init segment of the track. `HLS.get_track_kid_from_init` returns it. It reads
the first init segment of the playlist, unless you give it the init segment of the encrypted segments.
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. When only one of the two systems issues the
content key, also set `track.drm_preference` to it.