You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web player: move a lost HLS stream to a working route while the buffer still plays #4582
enhancementNew feature or requestimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishtriagedHigh-confidence review completed; does not mean fixed, validated, or accepted for release.
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.
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).
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.
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.
enhancementNew feature or requestimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishtriagedHigh-confidence review completed; does not mean fixed, validated, or accepted for release.
Activity
Quick104 commentedon Nov 19, 2026
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'strack_changekeeps the active HLS window (the reuse path ininternal/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.