Skip to content

fix(web): start autoplay countdown when entering post-roll early - #162

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
d3v1l1989:fix/web-autoplay-countdown-stall
Jun 16, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
d3v1l1989:fix/web-autoplay-countdown-stall

Conversation

@d3v1l1989

@d3v1l1989 d3v1l1989 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On a series episode, the web player enters post-roll ~30s before the end and pauses the underlying video (intentional — VideoPlayer's post-roll effect pauses to stop HLS buffering the tail segment). However, the auto-play countdown in PlayingNextScreen is gated on postRollVideoEnded, which is only set to true on the native ended event.

A paused video never fires ended, so:

  • The "Up Next" overlay appears with the video paused.
  • The countdown never starts and auto-play never fires.
  • It only proceeds if the user manually resumes the video, letting it reach the end and emit ended.

Reported symptom (Silo Web, Win11/Firefox): "Picture-in-picture video pauses on transition to auto-play screen. Countdown for auto-play never starts. Will start working if you manually resume the video." — the player pauses exactly 30s before the end.

Approach

Arm the countdown gate (setPostRollVideoEnded(true)) at the moment we enter post-roll early in handlePlaybackStateChange, rather than waiting for an ended event that an intentionally-paused video will never emit. Entering post-roll early is the point at which we've decided playback is effectively over, so that is the correct moment to start the countdown. The existing ended-driven and fallback paths are unchanged.

One-file change in web/src/playback/WatchPlaybackChrome.tsx.

Testing

  • cd web && pnpm run lint — 0 errors
  • cd web && pnpm run format:check — clean
  • make verify-local-paths — clean
  • tsc -b — clean
  • pnpm test — playback/WatchRoute suites pass (the 5 failing ServerStorageStep tests are a pre-existing ResizeObserver is not defined env issue, confirmed failing on clean main, unrelated to this change)

Note: verified statically and via the test suite; not yet exercised in a live browser session against a running deployment.

Risk / scope

Bug fix, behavior-only, no API or schema changes. Auto-play for movies (no series_id) is unaffected — the early post-roll trigger only fires for series episodes.

Out of scope: a separate 404 GET /api/v1/catalog/items/{id} symptom observed in the same report (next-item detail lookup) is not addressed here; this PR fixes the countdown stall only.

AI-use disclosure

This change was implemented with AI assistance (Claude). The diff was reviewed and the reasoning/tradeoffs are as described above.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed post-roll overlay autoplay countdown that would stall when entering post-roll early (within 30 seconds of the end of a series episode). The countdown timer now displays and initiates properly.

When a series episode reaches 30s before its end, the player enters
post-roll and pauses the underlying video to stop HLS from buffering the
tail segment. A paused video never fires the `ended` event, but the
PlayingNextScreen countdown was gated on `postRollVideoEnded`, which only
became true on `ended`. The result: the "Up Next" overlay appears, the
video is paused, and the countdown never starts — it only resumes if the
user manually plays the video (letting it reach the end and fire `ended`).

Arm the countdown gate at the moment we enter post-roll early, since that
is the point at which we've decided playback is over, rather than waiting
for an `ended` event that an intentionally-paused video will never emit.
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1563872-697c-4bb9-952a-fc14db84b09d

📥 Commits

Reviewing files that changed from the base of the PR and between 203d9be and 88bad6d.

📒 Files selected for processing (1)
  • web/src/playback/WatchPlaybackChrome.tsx

📝 Walkthrough

Walkthrough

In WatchPlaybackHost, the early post-roll branch of handlePlaybackStateChange now sets postRollVideoEnded to true before calling controller.enterPostRoll. Inline comments explain that this is necessary because the paused video will not fire an ended event, which would otherwise stall the post-roll overlay's autoplay countdown.

Changes

Post-roll autoplay countdown fix

Layer / File(s) Summary
Set postRollVideoEnded before enterPostRoll in early post-roll path
web/src/playback/WatchPlaybackChrome.tsx
In the early post-roll condition (within 30s of series episode end), postRollVideoEnded is set to true with explanatory comments before controller.enterPostRoll(requestKeyValue) is called, ensuring the post-roll overlay autoplay countdown starts when the video is paused rather than waiting for a ended event that will never fire.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main behavioral fix: enabling the autoplay countdown to start when post-roll is entered early.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Quick104
Quick104 merged commit 6997306 into Silo-Server:main Jun 16, 2026
1 check passed
Quick104 pushed a commit that referenced this pull request Jun 17, 2026
When a series episode reaches 30s before its end, the player enters
post-roll and pauses the underlying video to stop HLS from buffering the
tail segment. A paused video never fires the `ended` event, but the
PlayingNextScreen countdown was gated on `postRollVideoEnded`, which only
became true on `ended`. The result: the "Up Next" overlay appears, the
video is paused, and the countdown never starts — it only resumes if the
user manually plays the video (letting it reach the end and fire `ended`).

Arm the countdown gate at the moment we enter post-roll early, since that
is the point at which we've decided playback is over, rather than waiting
for an `ended` event that an intentionally-paused video will never emit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants