Skip to content

fix(player): time Up Next from the end of the file, not the credits marker - #994

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/next-up-from-file-end
Nov 22, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
Rhainland:fix/next-up-from-file-end

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #910
Related issue: Silo-Server/silo-server Discussion #4443; #927 (likely fixed, not re-tested)
Validation tasks: changes #347 C9, #348 C9 (Next Up timing; not run yet); may change #321 C1, #322 C1 (#927, see below)

Other clients: Apple N/A (already times Next Up from the end of the file); Roku N/A (already does); Web Silo-Server/silo-server#4502

The Show Next Up setting offers "At end" and "N seconds before end", but on an episode with a credits marker, both the phone and the TV opened Up Next when the credits started, whatever was chosen (#910). The TV player never read the setting at all. The Apple apps and Roku open Up Next from the chosen number of seconds before the end of the file.

Both Android players now open Up Next when playback crosses the chosen number of seconds before the end of the file, and for "At end" only when playback ends.

Approach

  • NextUpPrompt.crossesPromptPoint (shared) decides the moment: forward playback crossing playback.next_up_prompt_seconds before the file's duration. A resume or seek past that point waits for the end, so reopening an episode near its end does not throw up the card at once. The phone and TV view models both use it.
  • Credits markers drive only Skip Credits now. Skipping credits that run to the end of the file ends playback, which opens Up Next.
  • The TV still records the closing-credits crossing on its own, so leaving during the credits keeps returning the series page to the next episode, as before. The Up Next point counts toward that only when the stream has ended.
  • The TV settings screen now assumes the same 30-second default as the settings store and the server.

#927 (credits followed by a preview open the end screen instead of Skip Credits) came from opening Up Next at the credits start, so it is probably fixed too. It has not been re-tested on that fixture, so it stays open.

Validation

  • ./gradlew testDebugUnitTest on this branch: shared 2,510, android-shared 2,312 and Android TV 1,407 tests pass. On the phone module, 1,011 tests ran and three FormattersTest cases failed; they compare decimal output ("1.0") under the build machine's locale and touch nothing in this change. :androidApp:assembleDebug and :androidTvApp:assembleDebug build.
  • Lint (lintDebug for all three modules, lintVitalRelease for both apps) passes with no new findings, run on the stacked Off branch that contains this change.
  • Supply-chain checks pass.
  • Not captured: a recording of Up Next opening on a device; the timing is covered by the new unit tests.

Evidence

No screen changes: Up Next looks the same and opens at a different time. How it was checked, on this branch:

NextUpPromptTest: opens when playback crosses N seconds before the end; already past
the point does not reopen; At end and an unknown duration never open early
shared 2510 tests, android-shared 2312, androidTvApp 1407: 0 failures
androidApp 1011: 3 FormattersTest failures (locale decimal separator, not touched here)

Risks

Viewers who relied on Up Next opening at the credits start now see it at their Show Next Up time (30 seconds before the end by default).

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

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code, GitHub CLI, Codex CLI (review only)
  • Model(s): claude-opus-5-5; reviewers gpt-6.2-sol, gpt-6.2-astra, claude-fable-5-2
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: four independent reviews (gpt-6.2-sol, gpt-6.2-astra, claude-opus-5-5, claude-fable-5-2) of the branch diff for correctness, repository standards and [bug] "Next Up" timing choices appear at the same time and rely on credit markers, not file end #910; the real findings were fixed before opening (the TV series-page return point that moved with Up Next)

Note

Fix Up Next prompt to trigger from end of file, not credits marker

  • Phone and TV players now open the Up Next card when playback crosses NextUpPrompt.crossesPromptPoint (duration minus prompt seconds), instead of when it crosses the credits marker. The check is skipped during seeks.
  • The prompt setting is now seconds before the file end; zero or unknown duration means no early prompt. TV defaults to 30 seconds (was 10), read via a new nextUpPromptSeconds StateFlow in TvPlayerViewModel.kt.
  • Renamed MarkerTimeline.upNextCreditsStart to finalCreditsStart; it now only feeds skip controls and the closing-credits flag. TV's onApproachingEnd only sets reachedCreditsOrEnd when playback ends.
  • Adds tests for the prompt-point crossing logic in NextUpPromptTest.kt and an integration test that a credits marker no longer triggers Up Next.
  • Behavioral Change: episodes without a credits marker that previously used a duration fallback, and users with the old 10-second TV default, now see the prompt at the configured pre-end point instead.

Macroscope summarized 4c481a2.

…arker

The Show Next Up setting offers "At end" and "N seconds before end", but on
an episode with a credits marker both apps opened the card at the credits
start whatever was chosen. The TV player never read the setting at all.

Both players now open Up Next when playback crosses the chosen number of
seconds before the end of the file, and only when the stream ends for "At
end", as the iOS and tvOS player already does. Credits markers still drive
Skip Credits; skipping credits that run to the end ends the stream, which
opens the card. The TV settings screen now assumes the same 30-second
default as the settings store and the server.

Fixes Silo-Server#910
…credits

Moving Up Next to the end of the file also moved the point at which the TV
player treats an episode as finished for the series page. Leaving during
the closing credits then opened the series on the episode just watched,
and leaving after an early prompt during the final scene opened it on the
next one.

Record the closing-credits crossing on its own again, and count the Up
Next prompt only when the stream has ended. Update the comments that still
described the credits-based trigger.
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: fb0a842c-e4fb-4b44-b8c8-c14087c360ca
Commits

Reviewing files that changed from the base of the PR and between bb59172 and 4c481a2.

Files selected for processing: 9

  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelLoadOwnershipIntegrationTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/TvSettingsViewModel.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/domain/player/MarkerTimeline.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/domain/player/NextUpPrompt.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/domain/player/MarkerTimelineTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/domain/player/NextUpPromptTest.kt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 ❌

@macroscopeapp

macroscopeapp Bot commented Nov 18, 2026

Copy link
Copy Markdown

Up Next now opens at the configured point before the file ends instead of at the credits marker (PlayerViewModel.kt, TvPlayerViewModel.kt, and NextUpPrompt.kt), reaching the Android phone, tablet, foldable (folded and open), and Android TV. The Evidence section says no device recording was captured; add recordings demonstrating the timing on each device/state, labeled with device and build or commit. Unit tests do not show this user-visible playback timing.

Suggested fix: Attach the recordings under Evidence, or publish them on evidence.siloserver.org and link the evidence page.

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

Posted via Macroscope — Visible change evidence

Comment on lines +22 to +23
val promptStart = duration - promptSeconds
return previousPosition < promptStart && position >= promptStart

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

Short episodes never cross the configured Up Next prompt point

Episodes at or below the configured offset end without showing Up Next because promptStart is nonpositive and playback starts at zero. Handle this boundary explicitly so the prompt can appear during playback.

Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/domain/player/NextUpPrompt.kt, lines 22-23:

Short episodes never cross the configured Up Next prompt point

A file whose duration is less than or equal to the configured offset never shows Up Next before ending because its prompt point is nonpositive and playback positions start at zero. Handle this boundary explicitly so short episodes can surface the prompt during playback.

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.

Same as main. The phone already computed the point as duration minus the lead time and needed a forward crossing, so a file no longer than the lead never opened the card early; the TV never used the setting at all. Such a file still gets Up Next when the stream ends (onApproachingEnd(videoEnded = true)). The longest lead is 2 minutes, so this only affects clips, not episodes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That context changes the assessment: short files still get Up Next when playback ends, so the suggestion overstates the impact. The phone’s behavior is also unchanged from main; the TV’s prior behavior was different because it did not use the setting.

There is still a boundary case: for a file no longer than the configured lead time, the prompt cannot open early under the crossing logic. Whether to change that is a product decision rather than necessarily a regression in this PR. I would not treat it as blocking #994.

@silo-triage silo-triage Bot added bug Something isn't working needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish labels Nov 18, 2026
…t point

An Up Next overlay the viewer opened by hand has no countdown. Once the
before-end point covered every episode, playback crossing it committed that
same overlay with a countdown, which advanced as soon as the stream ended.
The crossing now leaves a hand-opened overlay alone; the end still commits it
as before.

The closing-credits check that sets the series-page return also skips while
Play Now's handoff is running, as onApproachingEnd did before it moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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.

Review of 445ca87. Two TV findings, both small; I'm fixing them in a commit on this branch, so there's no need to change them yourself.

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

@silo-kody

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

// the series page, though Up Next waits for the prompt point.
// Not once Play Now has started the handoff: the outgoing item no longer
// decides where the series page returns.
if (!seekWasActive && roomId == null && !nextUpTransitionGate.isActive) {

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

A failed handoff can permanently lose the credits crossing

If the handoff fails after playback crosses the credits, the series page returns to the outgoing episode because later position reports cannot cross the marker again. Preserve or recompute the credits state when the handoff is canceled instead of discarding it while nextUpTransitionGate.isActive.

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

A failed handoff can permanently lose the credits crossing

If playback crosses the credits while Play Now is waiting for subtitle settlement or session stop and that handoff fails, the crossing is discarded even though playback remains on the outgoing episode. The series page then returns to that episode instead of the next one because subsequent position reports cannot cross the marker again; preserve or recompute the credits state when the handoff is canceled.

Talk to Kody by mentioning @kody

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

​

​

@Quick104

Copy link
Copy Markdown
Contributor

Review summary (head 4c481a2)

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

Up Next on Android now opens at the viewer's Show Next Up time before the end of the file, as Apple and Roku already do, and #910's bug no longer reproduces in the code. Credits markers drive only Skip Credits.

Addressed in 4c481a2

  • A TV Up Next opened by hand got a countdown once playback crossed the prompt point and advanced as soon as the stream ended. The crossing now leaves a hand-opened overlay alone; the end commits it as on main.
  • The new closing-credits check now skips during Play Now's handoff, as onApproachingEnd did on main.

Checked and left as they are

  • Short files no longer than the lead time get Up Next only at the end, as on main (the earlier Kody thread).
  • A two-minute lead can open Up Next before an earlier credits range, so Skip Credits for that range is behind the card. That follows from the time the viewer chose.
  • Seeks issued through MediaSession (the phone notification), split episodes in series order, and turning auto-play off while a countdown runs behave the same way on main. They are outside this PR and haven't been confirmed as defects.

Validation

Other checks

  • User manual: siloserver.org#409 already covers this. It should also correct the markers page, which still says the player opens Up Next where the credits start.
  • Other clients: Apple and Roku already time Up Next from the end of the file; Web is fix(web): time Next Up from the end of the file silo-server#4502.
  • Cross-provider round: one adversarial review (gpt-6.2-sol) of 445ca87. Its two findings this PR caused are fixed above; the rest are under "Checked and left as they are."

For the maintainers

  • Fit: this aligns Android with the other clients and with the setting's own wording, without adding a setting.
  • Readiness holds at 8 because the TV timing hasn't been seen on a device.

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

@Quick104
Quick104 merged commit e580e18 into Silo-Server:main Nov 22, 2026
10 checks passed
Quick104 added a commit to Rhainland/silo-android that referenced this pull request Nov 23, 2026
Brings in Silo-Server#994 as merged on main. The three conflicts were additions next to lines main changed; each keeps this branch's block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] "Next Up" timing choices appear at the same time and rely on credit markers, not file end

2 participants