Skip to content

fix(player): restart backward HLS seeks - #499

Merged
Quick104 merged 1 commit into
mainfrom
t3code/fix-issue-498
Jul 27, 2026
Merged

Quick104 merged 1 commit into
mainfrom
t3code/fix-issue-498

Conversation

@Quick104

@Quick104 Quick104 commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

During copy-mode HLS playback, seeking to a media timestamp earlier than the current stream origin could leave playback near the current position instead of moving backward. I reproduced #498 against the shared debug deployment with the local Vite frontend: after seeking to 4150.8s, a seek to the beginning remained around 1:09 because the media element was asked to seek to local time zero inside the existing HLS window.

Approach

Preserve negative player-time offsets when a media target precedes the current HLS stream origin. Copy-mode HLS already advertises can_seek_anywhere=false; the negative offset therefore falls outside the media element's seekable ranges and reaches the existing transcode restart path instead of being mistaken for local time zero.

The regression test locks in that pre-origin media targets remain negative while media-time output retains its existing non-negative clamp.

Verification

  • pnpm exec vitest run src/player/utils/mediaTimeline.test.ts — 6/6 passed.
  • Real browser repro against https://silo.arkyncdn.net through the local Vite proxy — before: backward seek stayed near 1:09; after: the same seek showed 0:00, restarted ffmpeg with seek_seconds=0, and playback advanced from the beginning.
  • pnpm run lint — passed with 0 errors (existing warnings only).
  • pnpm run format:check — passed.
  • pnpm run build — passed.
  • GOWORK=off GOCACHE="$DEV_CACHE_ROOT/go-build" GOMODCACHE="$DEV_CACHE_ROOT/go-mod" go build ./internal/... ./cmd/... — passed.
  • make verify-local-paths — passed.
  • Full pnpm test — 1,367 passed; 6 unrelated failures remain in SeasonContent.test.tsx and ServerStorageStep.test.tsx. Both failing files are unchanged from origin/main (missing test QueryClient/ResizeObserver setup).

A browser recording and screenshot were captured locally under output/playwright/issue-498/. GitHub attachment is still needed if maintainers want the raw UI recording on the PR.

Adversarial review

Clean — no material findings.

  • Pre-commit autoreview: patch correct, confidence 0.99.
  • Committed branch review against main: approved; confirmed copy-mode HLS sets can_seek_anywhere=false, the pre-origin target falls through to the server restart, and no other production consumer receives the negative value.

Risks & follow-up

Low risk: toPlayerTime has one production caller, the web video player's seek path. Encoded HLS streams use origin zero, so their behavior is unchanged. No Android or Apple client follow-up is required because this change is isolated to the web player.

Closes #498

AI Disclosure

  • Tool(s): Codex in T3 Code
  • Model(s): gpt-5.6-sol
  • Involvement: fully AI-generated
  • Adversarial review: two Codex reviews found no material issues; the branch-level review specifically verified the only production caller and copy-HLS restart semantics.

🤖 Generated with Codex

Summary by CodeRabbit

  • Bug Fixes
    • Improved timeline handling for media targets that occur before the stream origin.
    • Preserved negative player-time offsets so earlier targets can be detected accurately.
    • Maintained existing handling for media times before the valid seekable range.

Preserve negative player-time offsets for targets before a copy-mode HLS window so the existing transcode restart path handles them.

Co-Authored-By: GPT-5.6 Sol <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

toPlayerTime now preserves negative offsets for targets before the stream origin instead of clamping them to zero. Unit tests verify the new -2990 result while retaining the existing toMediaTime behavior.

Changes

Media timeline offset handling

Layer / File(s) Summary
Preserve pre-window player offsets
web/src/player/utils/mediaTimeline.ts, web/src/player/utils/mediaTimeline.test.ts
toPlayerTime returns negative media-to-origin differences, with tests covering an out-of-window target and the existing toMediaTime result.

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

Suggested labels: v1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes preserve negative offsets for pre-origin seeks, matching the linked bug fix for restarting transcoded playback.
Out of Scope Changes check ✅ Passed The PR only changes the player time utility and its regression test, both directly related to backward seek handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: fixing backward HLS seeking behavior in the player.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/fix-issue-498

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jul 27, 2026
@Quick104
Quick104 merged commit 1a784a1 into main Jul 27, 2026
1 check passed
@Quick104
Quick104 deleted the t3code/fix-issue-498 branch July 27, 2026 20:23
cursor Bot pushed a commit to Prairie-Server/prairie-server that referenced this pull request Jul 27, 2026
Bring in fix(player): restart backward HLS seeks (Silo-Server#499).

Co-authored-by: Jonah May <[email protected]>
dreulavelle added a commit to kipsilabs/Vio that referenced this pull request Jul 27, 2026
fix(player): restart backward HLS seeks (Silo-Server#499)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[bug] Web player does not seek backward during transcoded playback

1 participant