Skip to content

fix(player): hold next-episode prompt until playback ends when post-credits content exists#1325

Open
anikettuli wants to merge 2 commits into
NuvioMedia:cmp-rewritefrom
anikettuli:fix/autoplay-next-episode-bundle
Open

fix(player): hold next-episode prompt until playback ends when post-credits content exists#1325
anikettuli wants to merge 2 commits into
NuvioMedia:cmp-rewritefrom
anikettuli:fix/autoplay-next-episode-bundle

Conversation

@anikettuli

Copy link
Copy Markdown
Contributor

Summary

When an outro skip interval exists for the current episode, the next-episode card fired as soon as playback reached outroInterval.startTime. With auto-play next episode enabled this advances to the next episode during the credits, skipping any post-credits scene that lives between the outro end and the episode's actual end.

PR type

  • Behavior bug/regression fix

Why

PlayerNextEpisodeRules.shouldShowNextEpisodeCard hard-coded the trigger at outro start whenever an outro interval exists. A naive fix of deferring the trigger to the outro end is not enough — the post-credits scene starts at the outro end, so a card firing there still cuts the scene off after the 3-second auto-play countdown.

Instead, when the gap between the outro end and the episode duration is at least 30 seconds (a post-credits tail rather than trailing logos/silence), the outro-based trigger is suppressed entirely and the existing playback-ended handler in PlayerScreenRuntimeEffects shows the card at the true end of the episode — matching the issue's expectation that the prompt holds until the episode truly ends. Episodes whose outro runs to (or nearly to) the end keep the fire-at-outro-start behavior unchanged, as do episodes with no outro data (threshold modes untouched) and episodes with unknown duration.

The 30-second tail threshold is a judgment call — happy to tune it or make the post-credits hold a setting if preferred.

Issue or approval

Fixes #1305

UI / behavior impact

  • No UI change
  • Behavior changed only to fix a documented bug/regression

Policy check

  • I have read and understood CONTRIBUTING.md.
  • This PR is small, focused, and limited to one problem.
  • This PR is not cosmetic-only.
  • Any UI change fixes a linked glitch/bug and includes visual proof, or this PR has no UI change.
  • Any behavior change fixes a linked bug/regression or has explicit approval, or this PR has no behavior change.
  • This PR does not bundle unrelated refactors, cleanups, formatting, or drive-by changes.
  • This PR does not add dependencies, architecture changes, migrations, or product-direction changes without explicit approval.
  • I listed the testing performed below.

Scope boundaries

  • The skip-outro button and intro/recap skip behavior are untouched — only the next-episode card trigger changes.
  • The percentage / minutes-before-end threshold modes (used when no outro data exists) are unchanged.
  • [Bug]: Autoplay next episode uses plugins instead of source used #1301 (autoplay ignoring binge group) is intentionally NOT bundled — it was already addressed by the StreamsRepository rewrite that threads persistedBingeGroup and bingeGroupOnly through every selector call site.

Testing

./gradlew :composeApp:compileFullDebugKotlinAndroid passes clean. ./gradlew :composeApp:testFullDebugUnitTest passes.

New unit test PlayerNextEpisodeRulesTest:

  • asserts an outro with no post-credits content still fires at outro start
  • asserts a 70-second post-credits tail suppresses the card during the outro, at outro end, and mid post-credits scene
  • asserts a tail just under the 30-second threshold keeps the outro-start behavior (no regression for episodes with brief trailing logos)
  • asserts unknown duration falls back to the outro-start trigger

Manual (please verify during review — needs a device):

  • Play an episode with outro timecodes and a post-credits scene, autoplay enabled: the next-episode prompt should not appear during credits or the post-credits scene; it fires when playback actually ends.
  • Play an episode whose outro runs to the end: the prompt appears at outro start as before.
  • Play an episode with no outro data: the configured threshold behavior is unchanged.

Screenshots / Video (UI changes only)

Not a UI change.

Breaking changes

None.

Linked issues

Fixes #1305

…redits content exists

When an outro skip interval exists, the next-episode card fired at
outroInterval.startTime. With auto-play next episode enabled this
advances to the next episode during the credits, skipping any
post-credits scene that lives between the outro end and the episode's
actual end.

Deferring the trigger to the outro end is not enough: the post-credits
scene starts at the outro end, so a card firing there still cuts the
scene off after the 3-second auto-play countdown. Instead, when the
gap between the outro end and the episode duration is at least 30
seconds (a post-credits tail rather than trailing logos/silence), the
outro-based trigger is suppressed entirely and the existing
playback-ended handler shows the card at the true end of the episode —
matching the reported expectation that the prompt holds until the
episode truly ends. Episodes whose outro runs to (or nearly to) the
end keep the fire-at-outro-start behavior unchanged.

New unit test PlayerNextEpisodeRulesTest:
- asserts outro with no post-credits content still fires at outro start
- asserts a 70s post-credits tail suppresses the card during the
  outro, at outro end, and mid post-credits scene
- asserts a tail under the 30s threshold keeps outro-start behavior
- asserts unknown duration falls back to outro-start behavior

Fixes NuvioMedia#1305

Note: NuvioMedia#1301 (autoplay ignoring binge group) was already addressed by
the StreamsRepository rewrite that threads persistedBingeGroup and
bingeGroupOnly through every selector call site, so this PR scopes
down to the post-credits fix only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 11, 2026 23:45

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the “Next Episode” card trigger logic to account for outros and potential post-credits content, and adds tests for these scenarios.

Changes:

  • Adds a post-credits “tail” detection threshold and adjusts outro-based triggering logic.
  • Introduces common tests covering outro/no-outro and duration-known/unknown cases.
  • Adds a constant for the post-credits threshold (30s).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
composeApp/src/commonMain/kotlin/com/nuvio/app/features/player/skip/PlayerNextEpisodeRules.kt Implements post-credits tail detection and adjusts when the next-episode card can appear.
composeApp/src/commonTest/kotlin/com/nuvio/app/features/player/skip/PlayerNextEpisodeRulesTest.kt Adds tests validating next-episode card behavior with outros, post-credits tails, and unknown duration.

…-credits episodes

Relying solely on the playback-ended handler left the rules function
returning false for the whole episode, and streams whose duration
metadata overshoots the actual content never fire a clean ended event.
The card now appears once playback enters the last five seconds of the
episode, so the post-credits scene still plays out and the prompt
cannot be lost when ended never fires.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

[Bug]: Autoplay skips post-credits scenes

2 participants