Repository navigation
Description
What happened
In the web player, a seek made while a replan (a quality, audio, subtitle or output change) is in flight can be lost when the replacement stream takes over. The seek bar briefly shows the seek, then playback starts somewhere else. Five paths do this. Each is in web/src/player/components/VideoPlayer.tsx and each exists on main today:
- Refused replan before an original file's metadata loads. The
replanErroreffect clears the pending seek whenever a replan fails, though only a refused reanchor owns that seek. When the original file is still loading, itsloadedmetadatahandler then seeks to the plan's start position instead of the viewer's seek. - Replacement stream that can't seek anywhere. The replan handoff (
const replanSeek = replanSeekRef.currentin the transport effect) keeps the seek only when the new plan hascan_seek_anywhere. Otherwise it drops the seek and the stream starts at the plan's anchor. When no queued change follows to carry the seek, playback stays at the old position. Nothing requests a reanchor. - Room request still held when the replacement lands. In a Watch Together room, the room runs a seek to 30 s, then the host asks for 60 s, and the replacement stream lands before the room runs the 60 s request. The handoff reads
pendingSeekTimeRef(the held 60 s), skips it as a held room request, and starts at the plan position. It never falls back to the 30 s seek the room did run. - Browser decoder replacement. When a replan moves an original file to the browser decoder,
routeForPlan(web/src/player/engine/routing.ts) starts it atplan.timeline.player_start_seconds. The decoder never sees a seek made while the replan was in flight. - Out-of-window seek while a change is queued. During a replan, an in-window seek sets
replanSeekRef. A later seek outside the window goes toreanchorAt. The session folds it into the queued change and returnsfalse, soreleasePendingSeekclears the pending seek but leaves the olderreplanSeekRefin place. The replan's stream then starts at the earlier seek, a position the viewer has already left, until the queued change lands at the new one. The comment onreplanSeekRefsays a later seek drops it, and this path doesn't.
Steps to reproduce
This was not reproduced live. Each path was traced in source. Paths 1 to 4 were also reproduced as VideoPlayer tests in jsdom with mocked transports, on main and on the head of #4512.
For path 1, as an example: direct-play an original file whose clock starts at 10 s, with a plan start of 120 s. Before its metadata loads, ask for a quality change and seek to 30 s. Make the replan fail before the metadata arrives. The element lands at 130 s (the plan start) instead of 40 s (the seek).
Expected behavior
A seek made during a replan lands where the viewer asked, whatever stream takes over. A later seek replaces an earlier one, and a failed replan leaves the viewer's seek in place.
Silo version / commit
main at e8de111, and the head of #4512 (eb9e508).
Deployment
Not deployment-specific. Found by source review.
Area
Playback and transcoding
Clients affected
- Web UI
Client app and device
Web app, any browser.
Media and playback details
An original file played directly, and server-planned HLS or progressive streams during a replan.
Diagnostics report reference
None
Relevant logs
No logs available.
Technical notes
All five paths are about the seek target that replanSeekRef and pendingSeekTimeRef carry across a replan. A fix probably wants one place that records a viewer seek (pending seek, replan seek, onSeek), used by every branch of performPlayerSeek, including reanchorAt. The handoff would then need to deal with a replacement that can't reach the target. #4512 adds a local takeSeek helper in performPlayerSeek. This work changes the same function, so it should start after #4512 merges.
Source: found in review of #4512
AI harness
Claude Code (via T3 Code); Codex CLI
AI tool(s)
Claude Code, Codex CLI, GitHub CLI
AI model(s)
claude-opus-5-5, claude-sonnet-5-5, gpt-6.2-sol
AI involvement
Fully AI-generated. An agent checked each path against the source; no person has verified it yet.
Independent or adversarial review
Found during the review of #4512. gpt-6.2-sol reported paths 1 to 4 and reproduced them in jsdom. A claude-opus-5-5 code-review finder reported path 5. Each path was then checked against the source on main.
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 19, 2026
Reproduced on
origin/mainat bd40bd9 with a local build and a synthetic 10-minute MKV in headless Chromium, holding each replan request for 4 s. During an audio change to the second track, a seek to 300 s was lost: the browser decoder started at the old position (20 s) with the seek bar stuck at 300, and on a browser without WebCodecs the copy remux started back at 104 s. A quality change that failed on an original that had not loaded yet threw away three forward skips. With a second quality change queued, a seek outside the window did not move the first replacement stream.Cause: the handoff to the replacement stream only kept a seek when the new plan could seek anywhere and the seek came from an in-window seek. A failed change cleared any pending seek, a held Watch Together request hid the seek the room ran, and the browser decoder always started at the plan's position.
Fix in #4571: the replacement stream now starts at the viewer's newest seek, and asks the server for a stream there when it cannot seek to it itself. Checked on a local build of the fix with the same steps: the decoder and the copy remux resume at 300 s, the failed change keeps the skips, and the first stream after the queued change starts at the later seek. Component tests cover all five paths, including the Watch Together case, which I did not run live.
AI disclosure: reproduced and fixed by Claude Code (claude-opus-5-5) at the maintainer's direction.