Skip to content

HLS and LL-HLS playback

Every Sapsan stream is immediately available over HLS (fMP4/CMAF) without extra configuration. Live streams get LL-HLS with partial segments by default.

Playback URLs

What URL
Master playlist (all qualities) http://server/streaming/v/<stream>/index.m3u8
Single track playlist http://server/streaming/v/<stream>/variant/<track>/index.m3u8
Rewind http://server/streaming/v/<stream>/rewind/<seconds-ago>/index.m3u8
Archive by absolute time http://server/streaming/v/<stream>/index.m3u8?from=<utc_ms>&to=<utc_ms>

The master playlist carries qualities with RESOLUTION, FRAME-RATE, and CODECS; audio goes into rendition groups (EXT-X-MEDIA). G.711 audio (PCMA/PCMU) is not served over HLS — transcode such streams to AAC first.

LL-HLS

For live streams Sapsan serves full LL-HLS (protocol version 9):

  • EXT-X-PART partial segments at the live edge and EXT-X-PRELOAD-HINT for the next part;
  • blocking playlist reload: the client parameters _HLS_msn and _HLS_part hold the request until the requested segment/part appears;
  • playlist delta updates: _HLS_skip=YES shortens the playlist with an EXT-X-SKIP tag;
  • EXT-X-RENDITION-REPORT for fast quality switching;
  • PART-HOLD-BACK, CAN-SKIP-UNTIL, HOLD-BACK are derived automatically from segment and part durations.

LL-HLS can be disabled per client with ?llhls=false — the master playlist propagates it into all variant URLs, and the player gets classic HLS (version 7).

Tokens in playlists

If playback is token-protected, ?token= is automatically appended to every nested playlist URL: variants, init segments, segments, parts, and preload hints. The player only needs to open the master playlist with the token.

Segment count

The live playlist length is set by the stream's segments parameter:

streams:
  tv1:
    inputs:
    - udp: {host: 239.0.0.1, port: 5000}
    segments: 6

Diagnostics

Sapsan ships an HLS playlist validator: it estimates the expected latency and points at configuration problems with codes like LL-DISABLED, TARGETDURATION-INFLATED, PART-TARGET-LARGE, SPARSE-INDEPENDENT-PARTS (GOP too long for LL-HLS).

Note

TODO: how to run the validator (CLI/API).

Next steps