Skip to content

Web player: move a lost HLS stream to a working route while the buffer still plays #4582

Open

Description

@Quick104

Follow-up to #2498.

What users should get

When a stream node or the API stops answering during web HLS playback, the web player should move to a working route while it plays from its buffer, before the buffer runs out. Viewers would then see no stall at all when the server comes back or another node takes over in time. Admin Activity would also show the session on its new node within seconds, not at the end of the buffer.

What happens after #2498

Once hls.js gives up after a fatal network error, the player keeps playing the buffer. It starts the reconnect (protocol v3 §6.2) only when the buffer runs out, a seek lands outside the buffer, or hls.js fails again. That leaves three gaps:

  • A server that comes back early still costs one short stall when the buffer ends (about 3 seconds on a test stack).
  • When a stream node dies but the API still answers, the move to another node (fix(playback): replan around a transcode or proxy node that stopped answering #2292) waits for the buffer to run out, which can be up to about two minutes. Admin Activity shows the session on the dead node until then.
  • A viewer who stays paused reconnects only after pressing play or seeking.

Approach to weigh

While the buffer drains, probe or replan the route in the background, and switch transports once a new one is ready. After an API restart the playback session is usually gone, so a plain startLoad() retry on the same stream URL fails. A background retry would have to go through the same replan the reconnect uses, without pausing the element.

Code

  • web/src/player/components/VideoPlayer.tsx: hlsDrainingRef, reconnectFromDrainedStream, and the fatal hls.js error handler.
  • docs/architecture/playback-protocol-v3.md §6.2, steps 1 and 4.

Apple and Android don't use this path. Their restart behavior is tracked in Silo-Server/silo-apple#801 and Silo-Server/silo-android#586.

Activity

  1. added
    enhancement
    impact: playback
    priority: P2
    triaged
    on Nov 19, 2026
  2. Quick104 commented on Nov 19, 2026

    @Quick104
    ContributorAuthor

    One more case for this work, from review of #2498: while the buffer drains, a seek outside the stream's window asks for a seek_reanchor. If that fails because the server is unreachable, the player falls back to the reconnect. When the session survived the outage, the reconnect's track_change keeps the active HLS window (the reuse path in internal/api/handlers/playback_v3.go), so a target before the window resumes at the window's start. A route move during the drain should ask for a window at the pending seek instead of reusing the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementimpact: playbackpriority: P2triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions