Repository navigation
Conversation
A fatal hls.js network error restarted the load with nothing counting the attempts once the stream had played: the startup guard answers every later failure with another recovery, so a segment the source cannot serve was requested for as long as the player stayed open. One deployment fetched seg_00000.ts 147 times and seg_00037.ts 86 times in a two-minute window while the segment layer logged a frame-RPS error for every request. Count a transport's failed loads between completed ones. Failures on segments the transport had not reached yet are still retried, and a fragment that arrives clears the streak, so an ordinary hiccup survives. A segment that fails again is not a hiccup: it stops after its own small budget, a source whose segments each fail at a new index stops at the streak cap, and both surface the existing route-failure UI (replan, else the error overlay) instead of asking for the bytes again. The retry is now scheduled with a doubling backoff from one second, capped at eight seconds, instead of restarting the load on the same tick as the error; a retry already in flight absorbs the failures it was scheduled to answer.
With no user gesture in the page's history the browser refuses to start an unmuted element. The player answered a refusal by retrying the same `play()` four times, which cannot succeed, and then settled paused. Its readiness-driven autoplay can also never run at all when `canplay` has already passed, which left a ready element (readyState 4, 121 s buffered) under the loading cover with nothing to click. Either way the viewer had no way in. Treat a policy rejection as what it is: settle the player so no startup timeout blames the route, and show a tap-to-play overlay. The element's own listeners also probe the state, so a paused player with media ready and no gesture behind it gets the same overlay even if `play()` was never called. The tap is the gesture the browser wants, so the click starts the stream.
The notice named the format of the version the server landed on: "The chosen version could not be played, so Vio is playing 2160p HEVC HDR instead." That does not tell the viewer which release replaced theirs, and when a swap keeps the format the line describes the wrong thing. Name the release the effective row carries (`release_name`, else the provider label `edition_raw`) and fall back to the format label only when the row names no release. When both rows name the same release, stay quiet: a sibling mirror row is the same release playing, so claiming a replacement would be a downgrade the client cannot support.
Collaborator
Author
|
Superseded by #459, which contains this change plus the rest of the playback reliability bundle. Closing to keep the review surface to one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes N/A
Related issue: N/A
Validation tasks: none
Three client-side dead ends, measured against a deployed build on 2026-11-15.
Segment retries had no bound. Against a corrupt HEVC source the client fetched
seg_00000.ts147 times andseg_00037.ts86 times inside one two-minute window, while the server logged 788Error constructing the frame RPSlines across seven sessions. Once a stream has played, the startup guard answers every later fatal network error with another recovery, and nothing counted those recoveries, so a segment the source cannot serve was requested for as long as the player stayed open. The player ended on "Playback startup timed out or exhausted recovery attempts".A blocked autoplay had no way out. With
navigator.userActivation.hasBeenActive = falsethe player sat on "Loading video" withreadyState=4and 121 s buffered, never callingplay()and offering nothing to click. A programmaticplay()started it immediately.The substitution notice named the format, not the release. "The chosen version could not be played, so Vio is playing 2160p HEVC HDR instead." does not tell the viewer which release replaced theirs, and it is misleading when the swap kept the format.
Approach
Segment retries are counted per transport (
web/src/player/utils/segmentRetry.ts). A failure on a segment the transport had not reached yet is retried, and any fragment that arrives clears the streak, so an ordinary hiccup survives several blips. A segment that fails again stops after its own small budget, a source whose segments each fail at a new index stops at the streak cap, and both surface the existing route-failure UI: a replan when the host offers one, otherwise the error overlay. The retry is scheduled with a doubling backoff from one second, capped at eight, instead of restarting the load on the same tick as the error.Autoplay is detected two ways, because either can happen alone. A
play()rejection withNotAllowedErrorsettles the player and shows a tap-to-play overlay; the element's owncanplay,progressandloadeddatalisteners also probe the state, so a paused player with media ready and no gesture behind it gets the same overlay even whenplay()was never called. The tap is the gesture the browser wants, so the click starts the stream.The notice now names the release the effective row carries (
release_name, else the provider labeledition_raw), falling back to the format label only when the row names no release. Two rows that name the same release stay quiet: a sibling mirror row is the same release playing, so claiming a replacement would be a downgrade the client cannot support.web/src/player/utils/versionSubstitution.tsand the v2 liveness call are untouched. That release-identity helper lives onfix/web-v1-versions-and-notice, not onmainat this base; the same-release rule here is the subset of it that this notice needs.Validation
tsc -b: clean.VideoPlayer.test.tsx,VideoPlayer.reconnect.test.tsx,WatchPage.test.ts,segmentRetry.test.ts.main— the retry test sees no route failure and anotherstartLoad, both autoplay tests find no "Tap to play" button, and all three notice tests find the format copy or a notice that should be quiet.pnpm run lintdid not finish inside this environment's time limit.--checkon the touched files: clean.make verify-local-paths: clean.--no-verifybecause itsgo build ./...step fails in a fresh worktree before any change:web/embed.goembedsall:dist, which only exists after a frontend build.src/playeroutside the files above; the directory run passed 2107 of 2110 withpgs.test.ts("drops objects past 16 MiB") andWatchPlaybackChrome.shuffle.test.tsxfailing on timeouts that reproduce onmainat the same load.Risks
A segment that needs several minutes of on-demand encoding can now reach the retry cap and replan where it previously kept retrying. hls.js already spends four attempts of up to 45 s each before the player's own budget starts, so the cap is reached after roughly five minutes on one segment. The replan lands on another route, which is the better outcome for a stream that cannot be served.
The tap-to-play overlay only appears when the page has never seen a gesture (
hasBeenActive === false), so a viewer who paused deliberately is unaffected. Browsers withoutnavigator.userActivationkeep the current behavior.The notice still speaks for an unidentified substitution when the server published one; only the copy changed there.
Checklist
AI Disclosure
Posted by an AI agent (Muse Spark, OpenCode harness).