Repository navigation
Description
What happened
In the web player on Chrome and Firefox, which play HLS through hls.js, a backward seek made while a new stream loads after a quality or audio-track change is undone. Once the new stream's first fragment is buffered, playback jumps forward to the plan's start position. A forward seek in the same window is kept.
This was found in code review of #3508. It has not been reproduced on a running build yet. Before #3508 the opaque loading cover sat over the controls during this reload, so a mouse seek in that window was not possible. #3508 keeps the controls usable during the reload, which makes the window reachable.
Steps to reproduce
Expected steps, not yet run:
- In the web player in Chrome or Firefox, play a title whose plan can seek anywhere and is delivered over HLS.
- Change the quality (or audio track) so the player loads a new stream at the current position.
- While the new stream is still loading, drag the seek bar to a point before the current position.
- Observe: when the new stream starts, playback jumps to where the quality change happened, not to where you dragged.
Expected behavior
The seek made during the reload wins, as it does for forward seeks and, since #3508, for Safari's native HLS path.
Silo version / commit
main with #3508 applied (head 8a231d4)
Deployment
Local dev build
Area
Web app
Clients affected
- Web UI
Client app and device
Web UI in Chrome or Firefox (hls.js). Safari uses native HLS and is not affected after #3508.
Media and playback details
Any HLS delivery whose plan has can_seek_anywhere: true.
Relevant logs
None: not reproduced live. This comes from reading the source.
Technical notes
VideoPlayer.tsx creates the replacement hls.js instance with startPosition: effectiveInitialPosition (the plan's start). After the first fragment buffers, hls.js seekToStartPos() sets media.currentTime = startPosition whenever currentTime < startPosition and the element is not seeking. A backward seek leaves currentTime below the start position and gets overwritten. A forward seek leaves it above, so it survives.
A possible fix: when a seek is pending on a seek-anywhere plan, pass it as the new instance's startPosition (or call hls.startLoad(pending)). The native HLS metadata handler does the same in #3508, and it leaves a watch-party seek still held for the room alone.
AI harness
Claude Code (via T3 Code)
AI tool(s)
Claude Code, GitHub CLI
AI model(s)
claude-opus-5-5
AI involvement
Fully AI-generated from a code-review finding on #3508, filed at the maintainer's direction. Not reproduced live.
Independent or adversarial review
Found by an independent claude-opus-5-5 review of #3508. The hls.js seekToStartPos() behaviour and the startPosition setting were checked against the source.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Activity
Rhainland commentedon Nov 11, 2026
Reproduced on
origin/mainat a9c7580 in headless Chromium (hls.js) on the production web bundle: while a synthetic file played at 150 s, I picked 720p and clicked the seek bar at 60 s before the replan answered. The old stream moved to 60 s, then the new stream started at 152 s, where the quality change was made.Cause: the seek was lost while the replan request was in flight, not after the new stream attached. The old stream completed the seek, then the new plan started at its
player_start_seconds, the position the quality change was asked for. A seek made after the new hls.js instance attaches was already kept, because hls.js moves its start position when the element seeks before the first fragment is buffered. Safari's native HLS path had the same gap.Fix in #3988: the first stream of the new plan starts at a seek made during the replan, on plans that can seek anywhere, for both hls.js and native HLS. Checked on a local build of the fix: the same steps now resume at 60 s, a quality change with no seek still resumes where it was made, and a seek after the new stream attaches is still kept. Component tests cover the hls.js and native HLS start position after such a seek, and that a replan that settles without a new stream drops it.
AI disclosure: reproduced and fixed by Claude Code (claude-opus-5-5) at the maintainer's direction.