Skip to content

fix(tv): reset the still-watching count when the viewer pauses or seeks - #876

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/tv-still-watching-reset
Nov 12, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/tv-still-watching-reset

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: changes #348 C9

Android TV's "Still watching?" stop resets its count only when the viewer presses Play Now. A viewer who pauses, skips or scrubs during every episode is plainly awake, but still gets stopped after N episodes. The phone app already treats those actions as activity and resets the count.

This PR resets the Android TV count on the viewer's play/pause, skips and seeks, matching the phone app. Web, iOS, tvOS and macOS get the limit with the same reset rules in Silo-Server/silo-server#3917 and Silo-Server/silo-apple#1091.

Approach

TvPlayerViewModel carries the count through each episode's launch arguments as autoAdvanceCount. It now goes back to 0 on play/pause, quick skip, scrub commit, every seekImmediate from the screen (hold-seek, chapters, intro and marker skips, cast) and explicit pause or unpause from a cast phone or the playback control socket. Intro auto-skip and Watch Party room seeks use a private seek that does not reset it.

Countdown expiry adds 1 to the count when it decides to advance, and Play Now resets it at that point too, rather than the episode handoff writing a count captured earlier. A reset made while the handoff runs (a cast phone or remote command) therefore sticks.

Validation

  • :androidTvApp:assembleDebug builds.
  • Real playback on an Android TV emulator (API 34) against a local server with five 60-second episodes and the limit set to 2: episode 1 auto-advanced; pausing and resuming episode 2 with the remote's play/pause button reset the count, so episodes 3 and 4 still auto-played; after episode 4 Next Up waited with no countdown; Play Now started episode 5.
  • Review fix 9a88bda (count updated at the advance decision, seekImmediate KDoc): :androidTvApp:compileDebugKotlinAndroid builds; checked by tracing every advance call site, not re-run on the emulator.
  • No new unit test: every path calls one reset helper, and the playback check covers the remote's play/pause.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/pr-876/

Surface and build: this branch on an Android TV emulator (API 34) against a local test library. No screen changes; the page shows when the existing Next Up stop appears after a pause reset the count. Android phone, tablet and foldable are unaffected: the change is in the TV player only.

Risks

None identified.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code
  • Tool(s): Claude Code; Codex CLI (review only)
  • Model(s): claude-opus-5-5; gpt-6.1-sol (review only)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: independent reviews by Claude Opus 5.5 and GPT 6.1 Sol of the combined web, Apple and Android diff, reconciled. No Android findings; the three copied resets were later folded into one helper.

Note

Fix still-watching count reset on viewer pause and seek in TV player

  • Viewer actions (play/pause, seek, skip, scrub) now reset the pass-out streak counter via a new TvPlayerViewModel.setPausedByViewer method and resetPassOutStreak helper in TvPlayerViewModel.kt
  • Non-Viewer actions do not reset the streak: room seeks (applyRoomSeek) and a new private seekWithoutViewerAction method execute seeks without touching the counter
  • Watch Party play/pause handling is unchanged and still returns early without local state changes
  • Behavioral Change: check TvPlayerViewModel.seekImmediate, commitScrub, onSkipBy, and the non-Watch-Party play/pause callbacks in TvPlayerScreen.kt — all now reset the counter

Macroscope summarized 01432ce.

Android TV only reset the pass-out streak on Play Now, so a viewer who paused,
skipped or scrubbed every episode still hit the "Still watching?" stop. Treat
those as deliberate interaction, like the phone app does.
@silo-triage silo-triage Bot added the size/S 0–49 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@silo-kody

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

Copy link
Copy Markdown

Explain Change →

Walkthrough

TvPlayerViewModel now resets the consecutive auto-advance count after a solo play/pause toggle, a skip request, or a committed scrub. The play/pause toggle does not reset the count during a Watch Party.

Changes: Playback interaction counter reset

Layer / File(s) Summary
Reset auto-advance count
androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
A new function resets the consecutive auto-advance count. The view model calls it after a solo play/pause toggle, a skip request, and a committed scrub.

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

Change: Bug fix

Suggested labels: bug, priority: P2, impact: playback, impact: usability, size/M

Suggested reviewers: quick104

Merge Risk: Minimal · up to a7eb3

Hold-seek and remote pause still do not reset the count, but this change improves other controls without worsening those existing behaviors.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly describes the Android TV still-watching count reset after playback interactions. It captures the main change, though it does not mention quick skips.
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.
Description check Passed The description explains the problem and approach: Android TV's still-watching count resets only on Play Now, and this PR resets it on play/pause, skips, and seeks in TvPlayerViewModel to match the ph…
Full details: Description check

Explanation

The description explains the problem and approach: Android TV's still-watching count resets only on Play Now, and this PR resets it on play/pause, skips, and seeks in TvPlayerViewModel to match the phone app. It also covers the validation run on an emulator, the risks, and the evidence link. It is directly related to the changeset, so the check passes.

Finishing Touches

Generate unit tests (beta)

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

@macroscopeapp

macroscopeapp Bot commented Nov 9, 2026

Copy link
Copy Markdown

The still-watching count now resets on play/pause, quick skip, and scrub commit, changing when the Next Up stop appears (androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt): Android TV evidence is missing. Add a recording of the multi-episode playback flow showing the changed stop behavior, and identify the device and build or commit.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

Comment on lines +4182 to +4183
private fun resetPassOutStreak() {
autoAdvanceCount = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

Activity after the next-up gate does not restore automatic advance

Viewer activity cannot restart the countdown because commitApproachingEnd has already set autoAdvanceHandled and evaluated the old count. Reevaluate the gate and start the countdown when resetPassOutStreak runs while the gated overlay is visible.

Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, lines 4182-4183:

Activity after the next-up gate does not restore automatic advance

When the next-up overlay has already been gated at the credits, resetting the count does not start the countdown because `commitApproachingEnd` has already set `autoAdvanceHandled` and evaluated the old count. Reevaluate the gate and start the countdown when viewer activity resets the streak while the gated overlay is visible.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. The phone app behaves the same way: AutoPlayGuard is checked once when the Next Up card is committed, and a later reset doesn't restart the countdown. Once the card is waiting, Play Now is the way on; this PR only aligns which actions count as activity before that point.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed—I'll withdraw the suggestion. The intended behavior is to evaluate the gate once when the Next Up card is committed. Activity before that point resets the count; once the card is waiting, the viewer uses Play Now to continue. This matches the phone app and keeps the PR focused on aligning activity detection.

// In a Watch Party every toggle goes through the room; a local flip
// here would fork this viewer from everyone else.
if (roomId != null) return
resetPassOutStreak()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

Cast play, pause, and seek commands do not reset the streak

Viewers using cast play, pause, or seek commands can hit the inactivity gate despite interacting. Reset the streak for those commands too; check setPaused and seekImmediate.

Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, line 4191:

Cast play, pause, and seek commands do not reset the streak

The reset only covers toggle-based playback, while the cast adapter's explicit play and pause commands call `setPaused` and its seek command calls `seekImmediate` directly. Viewers controlling playback through those commands still hit the inactivity gate despite interacting, so reset the streak on these user-initiated cast commands as well.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 01432ce: cast play/pause go through a viewer variant of setPaused that resets the count, and seekImmediate itself now resets it, since every caller outside the ViewModel is a viewer seek. Intro auto-skip and Watch Party room seeks use a private seek that does not.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. Based on your description, commit 01432ce84 addresses the cast play, pause, and seek paths while keeping intro auto-skip and Watch Party room seeks from resetting the count. I haven’t independently verified the commit.

@coderabbitai coderabbitai Bot added bug Something isn't working impact: playback Can't play, stalls, or wrong media impact: usability Core flow broken or severely blocked priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. labels Nov 9, 2026
@silo-triage silo-triage Bot removed the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

Minor · Reset the streak for hold-seek commits. · TvPlayerViewModel.kt:4213-4215

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4213-4215
Minor · Functional Correctness · Quick win

Reset the streak for hold-seek commits.

TvPlayerScreen.kt’s commitCleanPlaybackSeek calls seekImmediate directly, so holding Left or Right and committing the preview does not reset the count. The viewer can still reach the pass-out gate after scrubbing. Route this user-driven seek through a reset path, while keeping intro auto-skips and room seeks excluded. (raw.githubusercontent.com)

Minor · Reset the streak for explicit remote pause commands. · TvPlayerViewModel.kt:4987-4988

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4987-4988
Minor · Functional Correctness · Quick win

Reset the streak for explicit remote pause commands.

remotePause and remoteUnpause bypass onPlayPause, so a viewer who pauses and resumes through the playback control socket keeps the old count. TvPlayerScreen.kt’s TvSiloCastPlayerRegistration also calls setPaused directly for phone commands. Add a user-command pause path that resets the count without resetting it for room or lifecycle updates. (raw.githubusercontent.com)

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: d145d954-02fb-40b6-8196-c4cc884e2271
Commits

Reviewing files that changed from the base of the PR and between 075e37d and a7eb31d.

Files selected for processing: 1

  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt

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

…te command

Viewer seeks from the TV screen (chapters, intro and marker skips, hold-seek,
cast) and remote pause and unpause now reset the count. Intro auto-skip and
Watch Party sync use a separate seek that does not.
@silo-kody

silo-kody Bot commented Nov 10, 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 ❌

@Rhainland

Copy link
Copy Markdown
Contributor Author

Both outside-diff findings from the CodeRabbit review are fixed in 01432ce: hold-seek commits (commitCleanPlaybackSeek) now reset the count because seekImmediate does, and remotePause/remoteUnpause go through the viewer variant of setPaused.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Two findings on 01432ce, one behavioral and one in a comment. I'm fixing both in a commit on this branch, so there's no need to change anything yourself.

The countdown-expiry advance captured the next count and wrote it only
after the handoff suspended, so a viewer's reset in that window (a cast
phone or remote command) was overwritten. Update the count where the
advance is decided instead: +1 at expiry, a reset on Play Now, unchanged
for a later shuffle part. Also correct the seekImmediate KDoc, which
still named room seeks as callers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added size/M 50–199 added + deleted lines (all files); change volume, not priority. and removed size/S 0–49 added + deleted lines (all files); change volume, not priority. labels 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 ❌

@Quick104

Copy link
Copy Markdown
Contributor

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

Fit: 9/10 · Readiness: 8/10 — conditional (assuming CI is green)

Reviewed head: 9a88bdac (01432ce plus one review-fix commit).

Addressed

  • A reset during an episode handoff was overwritten (low). Countdown expiry saved the next count, and the handoff wrote it back after an await. A cast or remote play/pause in that window was lost. Fixed in 9a88bda: the count changes where the advance is decided (+1 when the countdown expires, a reset on Play Now, no change for a later shuffle part), and the nextAutoAdvanceCount parameter is gone.
  • Stale seekImmediate KDoc (nit). It named room seeks as callers and claimed to mirror the phone's seekImmediate, which does the opposite. Fixed in 9a88bda.

Checked and left as is

  • Every caller of seekImmediate, setPausedByViewer, onPlayPause, onSkipBy and commitScrub is a viewer action. Intro auto-skip and Watch Party room seeks don't reset the count, and in a room onPlayPause returns before resetting.
  • The gate doesn't re-arm the countdown when someone acts after the Next Up card has already stopped. The phone behaves the same way; the thread with Kody settled this.
  • Commands from the playback control socket reset the count, including ones an admin sends. The paired Apple PR counts its remote (SiloControl) play, pause and seek the same way.

Remaining for maintainers

  • Phone parity. The phone resets the count on its own play/pause, seek and skip, and on a remote toggle. It does not reset on a remote pause, unpause or seek (PlayerViewModel.remotePause, remoteUnpause, remoteSeek). With this PR and silo-apple#1091, the phone becomes the only client that ignores those commands. Making it match isn't a one-line change, because the phone's cast connect and disconnect handoff calls the same remote* functions automatically.

Validation

  • Live: the author's run on an Android TV emulator at 01432ce, with the limit at 2, showed a pause resetting the count, and Next Up waiting after two more auto-advances. The review fix wasn't re-run live. It was checked by :androidTvApp:compileDebugKotlinAndroid, a trace of every advance call site, and a second cross-provider round.
  • Tests: none added, so no test was run against the base.
  • Validated features: the board lookup couldn't run on my side, so I couldn't confirm the body's changes #348 C9 line.
  • Evidence: the published page still matches. The fix changes only the handoff timing edge, not the flow it shows.

Other checks

  • Cross-provider review: Codex (gpt-6.1-sol), two rounds. Round 1 raised the two findings above, and round 2 found both resolved, with nothing new.
  • User manual: docs: describe the still-watching limit on web and Apple apps siloserver.org#363 already covers this change, and the fix doesn't change what it says.
  • Apple/Android parity: silo-apple#1091 is the Apple pair, and silo-server#3917 covers web. The phone gap is noted above.

Scores

  • Fit 9: this matches the Android phone's existing rule: deliberate play/pause, skip and seek count as watching. It adds no setting.
  • Readiness 8: the approach is sound and the author showed the main flow live. The review fix is proven by build and trace, not on a device.

@Quick104
Quick104 merged commit 69e142c into Silo-Server:main Nov 12, 2026
9 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 impact: usability Core flow broken or severely blocked 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.

2 participants