Repository navigation
fix(web): keep a seek made while a quality change loads - #3988
Conversation
On a seek-anywhere plan, a seek made while a replan of the session was in flight was undone when the new stream started: the stream began at the position where the quality change was asked for. The new HLS transport (hls.js and native) now starts at that seek, or at a seek still in flight, unless it is a room request the room has not run yet.
Pre-merge checks:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| const seconds = canSeekAnywhereRef.current | ||
| ? (pendingSeekTimeRef.current ?? seekDuringReplan) | ||
| : null; |
There was a problem hiding this comment.
Saved seeks are discarded when the replacement is a copy-remux plan
A seek completed during a replan is lost because copy-remux HLS plans set can_seek_anywhere to false. Reanchor the replacement plan when its timeline cannot represent the saved target.
Prompt for LLM
File web/src/player/components/VideoPlayer.tsx, lines 2789-2791:
Saved seeks are discarded when the replacement is a copy-remux plan
A seek completed during a replan is discarded when the replacement is a copy-remux HLS plan, because those plans set `can_seek_anywhere` to false even if the target is seekable in the old stream. Preserve the target by reanchoring the replacement plan when its timeline cannot represent the saved seek.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Not changing this here. On main, the same seek is also lost when the replacement plan can't seek anywhere. This PR keeps the existing #3508 rule that a saved seek only carries over to seek-anywhere plans, and the PR body names the copy-remux and direct-play case as out of scope. Re-anchoring a copy-remux plan on the seek target would change how those plans are requested.
There was a problem hiding this comment.
Agreed. The copy-remux case is a pre-existing limitation, and re-anchoring its plan would change request behavior beyond this PR’s stated scope. I’ll withdraw the suggestion for this PR.
The limitation may be worth tracking separately if preserving seeks across non-seek-anywhere replans is a future goal.
| const hlsStartPosition = () => { | ||
| const seconds = canSeekAnywhereRef.current | ||
| ? (pendingSeekTimeRef.current ?? seekDuringReplan) |
There was a problem hiding this comment.
A newer seek can be overwritten by the captured replan seek
A newer seek can clear pendingSeekTimeRef before native HLS metadata loads, causing the handler to jump back to the older seekDuringReplan target. Invalidate or update seekDuringReplan when a newer seek occurs.
Prompt for LLM
File web/src/player/components/VideoPlayer.tsx, lines 2788-2790:
A newer seek can be overwritten by the captured replan seek
A second seek made after the replacement is adopted but before native HLS metadata loads can settle and clear `pendingSeekTimeRef`, leaving `seekDuringReplan` holding the older target. The metadata handler then jumps back to that older target, so invalidate or update the captured replan target when a newer seek occurs.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
This doesn't happen. On native HLS, a seek made after the new src is set and before loadedmetadata can't finish: with no metadata the element has nothing to seek in, so it fires no seeked and pendingSeekTimeRef still holds the newer target when the handler runs. Only a viewer seek or the planRevision reset writes that ref in that window, and the reset runs in the commit that attaches the stream, before any later seek. Since 347f5fa the remembered seek is itself the pending seek, and any later seek replaces it, so the handler has no older value to fall back to.
🤖 Claude Code (claude-opus-5-5)
There was a problem hiding this comment.
You’re right; I withdraw the suggestion. The current PR diff no longer captures seekDuringReplan as a fallback for the native HLS metadata handler. It transfers the remembered seek into pendingSeekTimeRef, and hlsStartPosition() reads that ref when metadata loads. A later seek can therefore replace the remembered target without the handler falling back to the older value.
I reviewed the current diff; I did not independently verify Safari’s event timing.
…g seek The replanned stream started at the seek, but until it played the player still reported the plan's start as its position. A second quality or audio change, or a recovery replan, made in that window resumed there and undid the seek again. The remembered seek is now the new transport's pending seek, the same state a seek made while the stream loads uses, so the start position and the replan position agree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
One finding on the head, which I'm fixing in a commit on this branch, so there's no need to change it yourself. The approach holds: the seek is lost while the replan request is in flight, and starting the replacement stream there is the right place to fix it. Summary and scores follow in a separate comment.
🤖 Claude Code (claude-opus-5-5)
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Review summaryReviewed head: 347f5fa (the contributor's 84856cd plus one review fix). Fit: 9/10 · Readiness: 8/10 — conditional The seek is lost while the replan request is in flight, and the fix belongs in the web player, where the new stream's start position is chosen. It is small, adds no settings or API surface, and fixes a core playback control that #3508 made reachable. Readiness is 8 because the review fix hasn't been checked in a browser yet. Its component test failed on the previous head and passes now, but the live recording on the evidence page predates it. A rerun of the same hls.js steps on this head would make it ready. Addressed
Tests
Left for the maintainers
Validated featuresUnavailable: the 1.0 validation board couldn't be read from this review, so the PR body's User manualNo change needed. The manual's Quality section doesn't describe what happens to a seek during a quality change, and this makes the player do what a viewer expects. Apple and AndroidThis is a web-only fix to the web player. Whether the Apple and Android players lose a seek during a quality change wasn't checked in this review. Review methodclaude-opus-5-5 traced the code, ran a multi-pass code review, and checked the PR's tests against main. gpt-6.1-sol ran an independent adversarial review of 84856cd. Both found the replan-position gap fixed here and the queued-replan case filed as #4010. 🤖 Claude Code (claude-opus-5-5) |
| canSeekAnywhereRef.current && | ||
| seconds !== roomHeldSeekRef.current | ||
| ) { | ||
| rememberPendingSeek(seconds); |
There was a problem hiding this comment.
Promoted seek remains pending when the replacement uses the browser engine
Revises an earlier Kody suggestion on web/src/player/components/VideoPlayer.tsx:2789 (2026-11-11 17:49 UTC).
Playback starts at the wrong position while the pending seek and displayed position remain stuck at the old target. Apply the promoted target after attachBrowserEngine completes, or restrict promotion to transports that consume it.
Prompt for LLM
File web/src/player/components/VideoPlayer.tsx, line 2790:
**Revises an earlier Kody suggestion** on `web/src/player/components/VideoPlayer.tsx:2789` (2026-11-11 17:49 UTC).
Promoted seek remains pending when the replacement uses the browser engine
When the replacement uses the browser decode engine, the promoted target is never passed to `attachBrowserEngine`, so playback starts elsewhere while the pending seek and displayed position remain stuck at the old target. Apply the promoted target to the engine after attachment or restrict this promotion to transports that actually consume it.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Problem
Closes #3541
Related issue: N/A
Validation tasks: changes #199 (in-player controls: seek/scrub); no recorded case results on #199 yet
In the web player on Chrome (hls.js), a seek made right after picking a new quality or audio track was undone. Playback jumped back to where the quality change was made once the new stream started. Safari's native HLS path had the same gap. Since #3508 the seek bar stays usable during that reload, so viewers can reach this.
The window that loses the seek is the replan request itself: the old stream is still playing, completes the seek, and then the new plan starts at its
player_start_seconds, which is 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.Approach
VideoPlayerremembers the viewer's newest seek made while a replan of the session is in flight. The first transport of the plan that replaces it starts there instead of at the plan's start position: as the hls.jsstartPosition, and as the native HLS position atloadedmetadata. A seek still in flight when the new stream starts takes precedence, as before. The same rules as #3508 apply: only on a plan that can seek anywhere, and a watch-party seek request the room has not run yet still waits for the room's command.A replan that settles without a new stream, a later seek, or a new session (version switch, next episode) drops the remembered seek, so a later quality change starts where it was asked for.
A quality change that lands a direct-play or progressive-remux plan still starts at the plan's position, as before; this change covers the two HLS paths the issue names.
Web only. No API, server, or client app changes.
Validation
mainin headless Chromium on the production bundle, with a synthetic 1080p H.264 file playing direct: seek to 150 s, pick 720p, click the seek bar at 60 s while the replan is in flight. The new hls.js stream started at 152 s. On this branch it starts at 60 s. This happened both with the replan response held for 3 s and with no throttling (seek 150 ms after picking the quality).pnpm run lint,pnpm run format:check,pnpm run build,pnpm run budget:check,tsc, andmake test-webpass. No Go code changed, so the Go half of the gate was not run.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3988/
Surface and build: web app player at 1440px, recordings of the same steps on a local build of
mainand of this branch. Position log excerpt (elementcurrentTimein seconds):Phone width is unaffected: the change is in the player's stream start position, not its layout.
Risks
None identified. A queued second quality or track change still undoes the seek once it lands; that also happens on
mainand is tracked in #4010.Checklist
AI Disclosure
Note
Preserve seeks made during a quality change in
VideoPlayerstartPositionoptionMacroscope summarized 347f5fa.