Skip to content

fix(web): keep a seek when a queued quality or track change runs - #4025

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4010-queued-replan-seek
Nov 13, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4010-queued-replan-seek

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4010
Related issue: N/A
Validation tasks: changes #199 (in-player controls: seek/scrub); no recorded case results on #199 yet

In the web player, picking two qualities (or a quality and an audio track) in quick succession queues the second change behind the first. If the viewer then seeked before the first change answered, the first new stream started at the seek (since #3988), but the queued change still carried the position it was picked at. When it ran, playback jumped back there.

The queued request in usePlaybackSession kept its positionSeconds from when it was queued, and nothing told it about a later seek. #3988's remembered seek in VideoPlayer only covers the first replacement stream.

Approach

VideoPlayer now reports each seek it makes inside the stream it already has to the session (onSeek → reportSeek). When a quality, track or output change is queued, the session moves it to that position, so the queued request asks the server for a stream at the seek. This works the same way as the existing fold of a reanchor seek into a queued output change. A queued failure recovery or reanchor keeps its own position, and with nothing queued the report does nothing.

Web only. No API, server, or client app changes.

Validation

  • Reproduced on a local build of main in headless Chromium on the production bundle, with a synthetic 5-minute 1080p file: play at 120 s, pick 720p, pick 480p while the first replan is held for 4 s, click the seek bar at 30 s. The 720p stream started at 30 s; the 480p stream then jumped back to 123 s. On this branch the queued request carries 29.9 s and the 480p stream continues from about 30 s.
  • Neighbouring cases on the same build and data: two queued quality changes with no seek still resume where they were picked (123 s), and a single quality change with a seek during the replan still starts at the seek.
  • A session-hook test covers a seek made while a quality change is queued; it fails on main.
  • pnpm run lint, pnpm run format:check, pnpm run build, pnpm run budget:check, tsc, make test-web, make verify-local-paths, make verify-bidi, make verify-size-ratchet and make verify-case-collisions pass. No Go code changed, so the Go half of the gate was not run.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-4025/

Surface and build: web app player at 1440px, the same steps on a local build of main and of this branch. Position log excerpt (seek bar position in seconds):

before: 720p picked at 122.4 -> 480p queued -> seek to 30 -> 720p stream plays from 30.4 -> queued 480p sent with 122.97 -> plays from 123.2
after:  720p picked at 122.5 -> 480p queued -> seek to 30 -> 720p stream plays from 30.4 -> queued 480p sent with 29.9  -> plays from 30.3

Phone width is unaffected: the change is in the stream's start position, not its layout.

Risks

None identified. A seek outside the seekable window on a plan that cannot seek anywhere, made while a quality or track change is queued, is still refused and the queued change resumes where it was picked. That is the same on main and outside this issue, which covers seek-anywhere plans.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (via T3 Code); Codex CLI for code review
  • Tool(s): Claude Code, Codex CLI, GitHub CLI, Playwright (headless Chromium)
  • Model(s): claude-opus-5-5; gpt-6.1-sol (code review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: independent reviews by claude-opus-5-5 and gpt-6.1-sol of the full diff (correctness, standards, spec). GPT found nothing. Opus found no correctness or standards problems and noted one low-severity gap that predates this change: a seek outside the window on a plan that cannot seek anywhere is still refused while a change is queued. It is left out of scope and named under Risks. No code changed after the review.

Note

Preserve in-stream seeks when a queued quality or track change runs

  • When the player seeks within its current stream, VideoPlayer now reports the position to the playback session via a new callback prop; it does not report on the reanchor path.
  • usePlaybackSession uses the reported position to update the pending replan options, but only for pending quality, track, or output changes with a finite nonnegative position. A queued change that runs later now seeks to the user's position instead of the old one.
  • Adds tests for the queued-quality-change case and mocks the new method in existing test fixtures.
  • Risk: none identified; other pending operation types and invalid positions leave the pending replan unchanged.

Macroscope summarized 8c00a1e.

…e it waited

A quality or track change made while another replan is in flight queues
with the position it was asked at. A seek made before the first replan
answered never reached the queued request, so its stream jumped back to
that position. The player now reports in-stream seeks to the session,
which moves a queued quality, track or output change to the seek.
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 12, 2026
@silo-kody

silo-kody Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The player now reports accepted in-stream seeks to the playback session. When an eligible replan is queued, the session updates its position to the latest valid reported seek.

Changes: Queued seek position updates

Layer / File(s) Summary
Report seeks to queued replans
web/src/player/hooks/usePlaybackSession.ts, web/src/player/hooks/usePlaybackSession.test.ts
The session exposes reportSeek and updates the position of queued quality, track, or output changes when the reported position is finite and nonnegative. A test checks that a queued quality change uses the latest seek position.
Connect accepted player seeks
web/src/player/components/VideoPlayer.tsx, web/src/player/components/WatchPage.tsx, web/src/player/components/WatchPage.test.ts, web/src/player/components/WatchPage.trickplay.test.ts
WatchPagePlayer passes session.reportSeek to VideoPlayer. The player calls onSeek for seeks handled by the current stream; reanchor seeks do not use this callback. Test fixtures include a reportSeek mock.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bug, javascript, impact: playback

Suggested reviewers: quick104, blurbery

Merge Risk: Minimal · up to 8c00a

This fixes the web player reverting to an older position when a queued quality or track change runs after a seek. The change is small and limited to the web app, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a seek made while a queued quality or track change is pending is kept when that change runs. It uses the fix(web) convention and matches the changeset (onSeek/reportSe…
Linked Issues check Passed Issue #4010 requires that a seek made while a second quality or track change is queued replaces the queued change's position. The reviewed head adds reportSeek to usePlaybackSession (web/src/playe…
Out of Scope Changes check Passed All changed files relate to the #4010 fix. The hook change adds reportSeek. VideoPlayer.tsx adds an optional onSeek prop, WatchPage.tsx wires it, and the test files add a reportSeek mock and…
Description check Passed The description is directly related to the changeset. It explains the bug (a queued quality or track change in usePlaybackSession keeps a stale positionSeconds after a later seek), describes the fix (…
Full details: Title check

Explanation

The title names the main change: a seek made while a queued quality or track change is pending is kept when that change runs. It uses the fix(web) convention and matches the changeset (onSeek/reportSeek forwarding that moves the queued position) and the linked issue #4010.

Full details: Linked Issues check

Explanation

Issue #4010 requires that a seek made while a second quality or track change is queued replaces the queued change's position. The reviewed head adds reportSeek to usePlaybackSession (web/src/player/hooks/usePlaybackSession.ts). When a replan is queued and the reported position is finite and nonnegative, it rewrites positionSeconds for quality_change, track_change, and output_change requests. Recovery and reanchor requests keep their own positions. reportSeek is returned from the hook. The PR summary states that VideoPlayer calls onSeek for in-stream seeks, and that WatchPage passes session.reportSeek through. The PR also adds a session-hook test for a seek during a queued quality change. The VideoPlayer.tsx diff could not be read because its blobs were missing from the checkout, so the wiring in that file rests on the PR summary. The hook-side change, which holds the queued-position logic, was confirmed in source. Seeks that require a reanchor do not call onSeek, so they follow the existing reanchor path. That path is not covered by #4010's stated scope.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the #4010 fix. The hook change adds reportSeek. VideoPlayer.tsx adds an optional onSeek prop, WatchPage.tsx wires it, and the test files add a reportSeek mock and a regression test. No unrelated changes appear in the PR summary. The VideoPlayer.tsx diff could not be read, so its exact content is taken from the summary.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains the bug (a queued quality or track change in usePlaybackSession keeps a stale positionSeconds after a later seek), describes the fix (VideoPlayer reports in-stream seeks via onSeek to reportSeek, which updates the queued position), and gives validation steps, tests, and risks that match the files in the raw summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3ca85df-7409-4440-9525-ab1cd4a9fd67
Commits

Reviewing files that changed from the base of the PR and between 0b579aa and 8c00a1e.

Files selected for processing: 6

  • web/src/player/components/VideoPlayer.tsx
  • web/src/player/components/WatchPage.test.ts
  • web/src/player/components/WatchPage.trickplay.test.ts
  • web/src/player/components/WatchPage.tsx
  • web/src/player/hooks/usePlaybackSession.test.ts
  • web/src/player/hooks/usePlaybackSession.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot added bug Something isn't working impact: playback Can't play, stalls, or wrong media javascript Pull requests that update javascript code labels Nov 12, 2026
@silo-triage silo-triage Bot added the priority: P2 Limited scope, workaround exists, or polish label Nov 12, 2026
@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: 8c00a1e

I found no defects in this change, so this review has no line comments and adds no commits.

The bug is real on main. A hook-level probe that uses only API already on main queued a 480p change at 121 s and then told the session that playback was at 30 s. The queued request still sent position_seconds: 121. The queued options are dispatched unchanged from the finally block of replan, and nothing updates them in between. That conflicts with the "newest seek wins" behavior #3988 set for a single change, so it isn't intended.

The fix holds up. reportSeek only rewrites a queued quality, track, or output change. It leaves recovery and reanchor targets alone. A stale entry can't be dispatched, because the finally block already drops a pending replan from an older load. The rewrite also survives the output-refusal path, which spreads the current pending entry. Every in-window seek goes through performPlayerSeek, including remote-control and Watch Party room commands, so a single call there covers them. Stream-attach position restores write currentTime directly and correctly don't report. Refreshing the queued position from playbackPositionRef at dispatch time would be worse: adopting the preceding plan resets that ref to the plan's start position before the queued change goes out.

Tests. The 370 player tests pass on this head. The new hook test fails on main only because reportSeek doesn't exist there (a TypeError), so it proves the request rewrite, not the defect, and nothing tests the player-to-session wiring. The end-to-end behavior is shown by the author's before/after run on the evidence page. This review didn't reproduce it live.

Seeks this change doesn't cover. Two seeks are still lost while a change is queued, and both behave the same way on main. One is a seek outside the window on a plan that can't seek anywhere, which the PR already lists under Risks. The other is a seek on an original-file direct-play stream before its metadata loads. Both are filed as #4069, to start after this PR merges, since the fix touches the same seek path.

Left for the maintainers

  • The body has no Other clients: line. This review didn't check whether the Apple or Android player queues replans the same way.
  • The Validation tasks: line (changes #199) couldn't be checked against the board. Movies — Web #199's body has no recorded results.

Validated features: not checked, because the validation board couldn't be read. A seek can reach this code only while a quality, track, or output change is queued, and nothing changes when no change is queued.

User manual: unaffected. The manual doesn't describe how a seek interacts with a queued quality change.

Fit: 9/10 · Readiness: 8/10 — conditional

  • Fit: a small web player correctness fix in the 1.0 polish focus. It adds no API, setting, or new surface, and it reuses the pattern the session already uses to fold a reanchor into a queued output change.
  • Readiness: the approach is sound and no defect remains in the diff. The only proof of the player-side wiring is the author's live run, which this review didn't repeat.

Reviewed with read-only code-review passes and a cross-provider review (gpt-6.1-sol, one round). The cross-provider round's only finding was the pre-metadata direct-play seek, which is filed in #4069.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit b771b5d into Silo-Server:main Nov 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: playback Can't play, stalls, or wrong media javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Web player: a queued second quality or track change undoes a seek made during the first

2 participants