feat(hls): use the DRM of the track when no key tag can be licensed

This commit is contained in:
imSp4rky
2026-11-29 20:33:19 -07:00
parent 30ed17054d
commit ba2911056d
4 changed files with 174 additions and 2 deletions
+18
View File
@@ -455,6 +455,24 @@ to `None`, and after it your `on_track_downloaded` runs and gets the clear file.
runs on the server: the client sends the samples through the `samples` route, so a decrypter
that needs a process on the server also works for a remote client.
### A playlist whose key tag unshackle cannot license
A media playlist can name only a key system that unshackle does not read, such as an `skd://` key
over cbcs media, while the licence server of the platform also issues the same content key over
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.
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`.
### How unshackle chooses a CDM and finds keys
CDM selection is config-driven: the `cdm` map resolves a service tag (and optionally the