Skip to content

fix(web): keep a seek made before a direct-played original loads while a quality change is queued - #4512

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4069-direct-play-pending-seek
Nov 18, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4069-direct-play-pending-seek

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4069
Related issue: N/A
Validation tasks: none (#199 has no recorded case results)

Other clients: Apple N/A (web player only); Android N/A (web player only); Roku N/A (web player only)

In the web player, a seek on an original file that plays in the media element was lost if the file's metadata had not loaded yet and a quality or track change was queued. The player showed the seek, but the queued change still started where it was picked, and playback jumped back there. This fixes that path. The issue's other path, an out-of-window seek while a change is queued, already works on main.

The issue names two paths:

  1. Out-of-window seek (seek_reanchor). Already fixed on main: replan in usePlaybackSession now moves a queued quality, track or output change to the reanchor's position. I checked this on a local build of main (steps under Validation). The queued change is sent with the seek position and plays from there.
  2. Seek before an original file's metadata loads. Still broken on main. The directPlayOriginPendingRef branch of performPlayerSeek remembered the seek for the metadata handler. It did not report the seek to the session (onSeek, added in fix(web): keep a seek when a queued quality or track change runs #4025) and did not set replanSeekRef (added in fix(web): keep a seek made while a quality change loads #3988). The queued change kept its old position. The first replacement stream could also start at the old position before playing, and its controls showed that position.

Approach

A seek in the pre-metadata branch now goes through the same steps as an in-window seek. It is remembered as the pending seek and kept for the replan in flight, the session is told about it, and the controls show it. The metadata handler still seeks the original there once its clock is known. Web only. No API, server or client app changes.

Validation

  • Reproduced on a local build of main in headless Chromium on the production bundle. Browser decoding was off, so the original plays in the media element. The fixture is a synthetic 5-minute H.264/AAC MP4 with two audio tracks. Steps: play at 720p near 120 s, then switch to Auto, which direct-plays the original. Hold the original's media request so its metadata cannot load. Pick 720p (replan held 4 s), then 480p (queued), then click the seek bar at 30 s. The queued 480p request went out with 121.9 s, and playback ended up at about 122 s. On this branch, with the same steps and data, it goes out with 29.9 s and plays from about 30 s.
  • Neighbouring cases on the same build and data: with no seek, the queued change still resumes where it was picked (121.9 s). A seek before metadata with no change pending still lands the original at the seek. The path 1 steps (a progressive remux that cannot seek anywhere, a queued change, a seek to 250 s outside the window) send the queued change with 249.9 s, on main and on this branch.
  • A VideoPlayer test now runs the "new stream and a later quality change start at the seek" case on both a playing stream and an original whose metadata has not loaded. The second fails on main.
  • pnpm run lint, pnpm run format:check, pnpm run build, pnpm run budget:check, 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-4512/

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: Auto (original) at 121.9, metadata pending -> 720p sent with 121.9 -> 480p queued -> seek to 30 -> 720p plays from 29.9 -> queued 480p sent with 121.9 -> plays from 122.4
after:  Auto (original) at 121.9, metadata pending -> 720p sent with 121.9 -> 480p queued -> seek to 30 -> 720p plays from 29.9 -> queued 480p sent with 29.9  -> plays from 30.2

Phone width is unaffected: the change is in where the stream starts, not in the layout.

Risks

None identified for this change. Two existing limits apply to every seek made during a replan, not only this path. A first replacement stream whose plan cannot seek anywhere (a progressive remux) still starts at its plan's position until the queued change lands. During an out-of-window seek (path 1), the seek bar shows the old position until the queued change's stream plays.

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 how I checked a change nobody sees.

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.2-sol, gpt-6.2-astra, claude-fable-5-2 (code review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: four independent reviews of the full diff (correctness, standards, spec), by gpt-6.2-sol, gpt-6.2-astra, claude-opus-5-5 and claude-fable-5-2. No correctness findings. All four flagged the new tests as duplicating an existing case, so they were folded into one case run on both seek setups, and a test that case made redundant was removed. A follow-up review of the test change found nothing else. Sol and Astra noted that a first replacement whose plan cannot seek anywhere still starts at its plan's position. That limit predates this change and applies to every seek made during a replan, so it is listed under Risks.

…e a quality change is queued

On an original file whose metadata had not loaded yet, a seek was held for
the metadata handler but never reported to the playback session, and was
not remembered for the replan in flight. A quality or track change queued
behind that replan still resumed where it was picked, and the first
replacement stream could start there too. That seek now takes the same
path as an in-stream seek: it reports to the session and is remembered
for the replanned stream.
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 18, 2026
@silo-kody

silo-kody Bot commented Nov 18, 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 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

performPlayerSeek now reports origin-pending seeks to the playback session and retains their targets during replanning. Tests cover seeks made while a stream is playing and before original-file metadata loads, including the replacement stream and a later quality change.

Changes: Seek handling during replanning

Layer / File(s) Summary
Report seek targets and verify replacement streams
web/src/player/components/VideoPlayer.tsx, web/src/player/components/VideoPlayer.test.tsx
performPlayerSeek uses shared handling for origin-pending and in-stream seeks. Tests cover a pre-metadata seek and a seek during replanning, and verify the target reaches the replacement HLS stream and a later quality change.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested reviewers: quick104, neurekadev

Merge Risk: Minimal · up to eb9e5

This fixes the web player so a seek made before an original file's metadata loads is kept for a queued quality, audio or subtitle change. The change is small, web-only and covered by new tests. No merge-blocking issue was found.

Security architecture risk: Minimal · up to eb9e5

The change preserves a viewer’s seek position through an existing playback transition. No introduced or worsened risk materially affecting security, failure containment, rollback, or ownership was established in the inspected change.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #4069 has two paths. Path 2 (seek before an original's metadata loads) is implemented. In performPlayerSeek (web/src/player/components/VideoPlayer.tsx), the directPlayOriginPendingRef branch… Confirm in source at the reviewed head that replan in web/src/player/hooks/usePlaybackSession.ts folds a seek_reanchor into a queued quality_change and track_change, as the PR states. Name the lines that do this. Alternatively, add …
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the web player fix: a seek made before a direct-played original loads is kept while a quality change is queued. The changeset matches this. The summary shows performPlayerSeek routing …
Out of Scope Changes check Passed The whole-PR diff against the merge base touches web/src/player/components/VideoPlayer.tsx and VideoPlayer.test.tsx. The VideoPlayer.tsx change is limited to the seek path in performPlayerSeek, whic…
Description check Passed The description is specific and on-topic. It explains the bug (a seek before an original file's metadata loads is lost while a quality or track change is queued), the fix (the pre-metadata branch of p…
Full details: Title check

Explanation

The title names the web player fix: a seek made before a direct-played original loads is kept while a quality change is queued. The changeset matches this. The summary shows performPlayerSeek routing the pre-metadata seek through a shared helper that records the pending seek, preserves it for an in-flight replan, and notifies onSeek. The test changes cover this path. The title is specific and follows the conventional commit style. It omits the web-only scope detail, but it does not need to cover every detail.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches web/src/player/components/VideoPlayer.tsx and VideoPlayer.test.tsx. The VideoPlayer.tsx change is limited to the seek path in performPlayerSeek, which is the path 2 objective of #4069. The test change adds coverage for that path and for a playing stream. It removes one standalone test that the parameterized case replaces. The PR description reports no Go or API changes. I did not see any unrelated change in the reviewed evidence.

Full details: Description check

Explanation

The description is specific and on-topic. It explains the bug (a seek before an original file's metadata loads is lost while a quality or track change is queued), the fix (the pre-metadata branch of performPlayerSeek now follows the in-window seek steps), the validation steps and results, and the risks. It matches the changeset in web/src/player/components/VideoPlayer.tsx and VideoPlayer.test.tsx.

Full details: Linked Issues check

Explanation

Issue #4069 has two paths. Path 2 (seek before an original's metadata loads) is implemented. In performPlayerSeek (web/src/player/components/VideoPlayer.tsx), the directPlayOriginPendingRef branch now calls a shared takeSeek helper. That helper calls rememberPendingSeek, sets replanSeekRef when a replan is in flight, calls onSeek, and calls setCurrentTime. This matches the issue's technical note for path 2. The PR adds a VideoPlayer test for this case, and the PR reports that it fails on main. I did not run the tests. Path 1 (out-of-window seek_reanchor while a quality or track change is queued) is not changed by this PR. The PR states that replan in usePlaybackSession.ts already moves a queued change to the reanchor position on main, and it cites a local reproduction. The issue states the opposite for the code at 7edef3ddc4: replan returns false when a quality_change or track_change is queued. The file read at the reviewed head was truncated before the shouldQueue logic, so I could not confirm the fold at head. The PR also keeps the seek bar at the old position during an out-of-window seek until the queued stream plays. The issue's repro step 4 names that snap-back. The PR lists it under Risks as an existing limit, not as a fix.

Resolution

Confirm in source at the reviewed head that replan in web/src/player/hooks/usePlaybackSession.ts folds a seek_reanchor into a queued quality_change and track_change, as the PR states. Name the lines that do this. Alternatively, add a test that covers that case. State whether the seek bar must show the seek target during an out-of-window seek while a change is queued. The issue leaves that as a decision point. If the fold is absent at head, path 1 requires a code change.

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: 65399964-d53d-4fa0-920f-13eb91aca925
Commits

Reviewing files that changed from the base of the PR and between e8de111 and eb9e508.

Files selected for processing: 2

  • web/src/player/components/VideoPlayer.test.tsx
  • web/src/player/components/VideoPlayer.tsx

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

@silo-triage silo-triage Bot added bug Something isn't working impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish labels Nov 18, 2026
@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: eb9e508a70. No changes needed. I found no defects in this PR's change, so I'm not pushing anything to the branch.

What I checked

  • main hasn't changed web/src/player/ since this branch's merge base, so the branch needs no update and nothing on main supersedes it.
  • The pre-metadata branch of performPlayerSeek now takes the same steps as the in-window branch. I traced every caller: viewer seeks, Watch Together room seeks (issueRoomSeek), the remote-control seek command, and the intro-skip prompt. The in-window branch already reported each of them through onSeek and kept their seeks in replanSeekRef, so none sees new behavior beyond this path. reportSeek only moves a queued quality, track or output change, and does nothing when none is queued.
  • An original file always seeks anywhere, so a seek recorded before its metadata loads can't reach the reanchor branch on the same stream.
  • The new test row "an original file whose metadata has not loaded" fails on the base (onSeek is never called) and passes on this head. All 14 VideoPlayer tests pass on the head. The parameterized case keeps both assertions from the two tests it replaced.
  • I didn't repeat the live browser check. The author's before/after evidence is linked in the PR body.

Defects that predate this PR

The cross-provider round and a code-review finder found five paths where a seek made during a replan is still lost: a failed replan before metadata loads, a replacement that can't seek anywhere, a held room request, the browser decoder, and an out-of-window seek while a change is queued. Each one behaves the same on main, and the PR's Risks section already names one of them. They're tracked in #4516, to be fixed after this PR merges because the fix changes the same function.

Validated features

No passed case on the v1.0 board is affected. #199 (Movies — Web) has no recorded case results. Seek and marker cases that passed elsewhere (#1149 C2, #1156 C2) use performPlayerSeek but don't reach the pre-metadata path. I changed the Validation tasks: line to none because the changes #N form names a passed case and #199 has none.

User manual: unaffected. This fixes a playback position; no setting, label or documented step changes.

Other clients: the direct-play clock-origin wait is specific to the web player. The Apple, Android and Roku N/A entries hold.

Fit: 9/10 · Readiness: 9/10 — ready

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

@Quick104
Quick104 merged commit 4a73f48 into Silo-Server:main Nov 18, 2026
19 checks passed
Quick104 added a commit that referenced this pull request Nov 19, 2026
Resolve the seek conflict with main's takeSeek() helper (#4512), keeping
the draining-stream reconnect after it. Port the PR's lost-connection
tests onto main's pruned VideoPlayer.test.tsx (#4465) and take main's
deletion of mediaTimeline.test.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 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: an out-of-window or pre-metadata seek is still lost while a quality or track change is queued

2 participants