Skip to content

[bug] Web player: a seek made during a replan is lost in several handoff paths #4516

Closed

Description

@Quick104

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:

  1. Refused replan before an original file's metadata loads. The replanError effect clears the pending seek whenever a replan fails, though only a refused reanchor owns that seek. When the original file is still loading, its loadedmetadata handler then seeks to the plan's start position instead of the viewer's seek.
  2. Replacement stream that can't seek anywhere. The replan handoff (const replanSeek = replanSeekRef.current in the transport effect) keeps the seek only when the new plan has can_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.
  3. 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.
  4. Browser decoder replacement. When a replan moves an original file to the browser decoder, routeForPlan (web/src/player/engine/routing.ts) starts it at plan.timeline.player_start_seconds. The decoder never sees a seek made while the replan was in flight.
  5. 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 to reanchorAt. The session folds it into the queued change and returns false, so releasePendingSeek clears the pending seek but leaves the older replanSeekRef in 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 on replanSeekRef says 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

  1. added
    bug
    on Nov 18, 2026
  2. added
    impact: playback
    priority: P2
    on Nov 18, 2026
  3. Rhainland commented on Nov 19, 2026

    @Rhainland
    Contributor

    Reproduced on origin/main at 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.

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

    bugimpact: playbackpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions