Repository navigation
Conversation
Bring the phone player's end-of-episode flow to parity with Android TV. Instead of instantly auto-advancing at the credits marker (with a bare "Next Episode" button and a "Still watching?" dialog), the player now surfaces a dismissible Up Next card with the next episode's still, title, and runtime, plus a visible 10s countdown that auto-plays at zero. - PlayerViewModel: NextEpisodeInfo state (full EpisodeListItem fields), showUpNext/upNextVideoEnded/upNextCountdownSeconds card state, and a TV-mirroring onApproachingEnd/commitApproachingEnd/countdown flow with the pending re-arm for late next-episode resolution. Pass-out semantics match TV: shouldGate() at commit (gated or auto-play off = card without countdown), recordAutoAdvance() only on unattended countdown expiry, Play Now resets the streak. Watch Together rooms never show the card. - Trigger: credits-marker crossing wins when present; otherwise the card fires when crossing (duration - nextUpPromptSeconds) with the same before->after transition guard (0 = only at end, iOS parity); STATE_ENDED remains the fallback and upgrades the card label. - New UpNextCard composable: compact dark card bottom-end with ThumbhashImage still, "UP NEXT"/"PLAYING NEXT" eyebrow, runtime, "Play Now · N" countdown button, and a dismiss affordance. Replaces the StillWatchingPrompt dialog and the bare Next Episode button. - Settings: "Auto-Play Next Episode" switch and "Show Next Up" prompt-seconds dropdown in the phone Playback section, wired to the existing per-profile, server-synced store keys (labels mirror TV). Phone-only; no shared or TV module changes. Refs #23 Co-Authored-By: Claude Fable 5 <[email protected]>
Two audit fixes for the phone Up Next card: - The countdown on the credits/prompt-crossing path is now derived from the remaining playback time and only advances once the player reports STATE_ENDED (iOS parity), instead of a fixed 10s wall-clock timer that could truncate up to ~110s of an episode with no credits marker. The 10s wall-clock countdown is kept only for cards committed at STATE_ENDED, where no playback remains to anchor to. - Deliberate transport actions now interact with the non-modal card: pausing cancels the auto-advance countdown (card stays up without a countdown), and a user seek while the card is showing dismisses it, so the player can no longer yank a paused or rewatching user to the next episode. Room-driven seeks (seekImmediate) are unaffected. Co-Authored-By: Claude Fable 5 <[email protected]>
📝 WalkthroughWalkthroughReplaces the phone player's "Still watching?" prompt with an "Up Next" card driven by a new countdown-based auto-advance flow. PlayerViewModel introduces NextEpisodeInfo and Up Next state, resolves and commits next-episode info near credits/end, and manages countdown lifecycle. New PlaybackSettings controls configure auto-play and prompt timing. ChangesUp Next auto-play feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant PlayerScreen
participant PlayerViewModel
participant PlayerOverlay
participant UpNextCard
PlayerScreen->>PlayerViewModel: onApproachingEnd(videoEnded)
PlayerViewModel->>PlayerViewModel: resolveNextEpisode / commitApproachingEnd
PlayerViewModel->>PlayerViewModel: startUpNextCountdown
PlayerViewModel-->>PlayerOverlay: showUpNext, nextEpisode, upNextCountdownSeconds
PlayerOverlay->>UpNextCard: render(info, countdownSeconds)
UpNextCard-->>PlayerViewModel: onPlayNow / onDismiss
PlayerViewModel->>PlayerViewModel: advanceToNextEpisode / dismissUpNext
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5e892ce10
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // and its countdown, same once-per-episode semantics as an explicit | ||
| // dismiss. Room-driven corrective seeks go through seekImmediate and | ||
| // are unaffected. | ||
| if (_uiState.value.showUpNext) dismissUpNext() |
There was a problem hiding this comment.
Clear pending Up Next when seeking back
When the credits/prompt crossing fires before resolveNextEpisode() finishes, onApproachingEnd only sets pendingApproachingEndVideoEnded and no card is visible yet. If the user scrubs back during that window, this branch does not run because showUpNext is still false, so the late resolver can still call commitApproachingEnd and show/arm the Up Next card at the rewound position. Please also clear the pending latch for deliberate seeks, not only for an already-visible card.
Useful? React with 👍 / 👎.
| autoPlayGuard.recordAutoAdvance() | ||
| advanceToNextEpisode() |
There was a problem hiding this comment.
Honor auto-play being disabled during countdown
Once the Up Next countdown has been armed, this path advances without re-checking autoPlayNextEnabled. Because the player settings sheet still lets the user turn “Auto-Play Next Episode” off while the card/countdown is visible, that toggle appears to take effect but the coroutine will still auto-advance at end-of-playback. Re-read the setting before recording/advancing, or cancel the countdown when the flow turns false.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/UpNextCard.kt (1)
74-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse
NextEpisodeInfo.labelinstead of re-deriving the format.
NextEpisodeInfoalready exposes alabelcomputed property with the sameS{season}·E{episode} — {title}shape, but this line reimplements it with a different null-title fallback ("Next Episode" vs. no dash at all). This duplication can silently drift from the canonical label used elsewhere.♻️ Proposed fix
- Text( - text = "S${info.seasonNumber}·E${info.episodeNumber} — ${info.title ?: "Next Episode"}", - color = Color.White, - style = MaterialTheme.typography.bodyMedium, - maxLines = 2, - overflow = TextOverflow.Ellipsis, - ) + Text( + text = info.title?.let { info.label } ?: "S${info.seasonNumber}·E${info.episodeNumber} — Next Episode", + color = Color.White, + style = MaterialTheme.typography.bodyMedium, + maxLines = 2, + overflow = TextOverflow.Ellipsis, + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/UpNextCard.kt` around lines 74 - 80, The label for the next episode is being rebuilt inline in UpNextCard instead of using the canonical NextEpisodeInfo.label, which can drift from the shared format. Update the Text in UpNextCard to read from info.label and remove the duplicated S{season}·E{episode} — {title} construction so the screen stays consistent with NextEpisodeInfo.androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt (1)
289-323: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated bottom-end modifier chain.
The intro-banner
Boxand theUpNextCardAnimatedVisibilityboth repeat.align(Alignment.BottomEnd).padding(bottom = 120.dp, end = 24.dp).zIndex(2f). Consider hoisting this into a sharedval bottomEndSlotModifier = Modifier...to avoid drift if the slot position needs to change later.♻️ Proposed consolidation
+ val bottomEndSlotModifier = Modifier + .align(Alignment.BottomEnd) + .padding(bottom = 120.dp, end = 24.dp) + .zIndex(2f) + if (!state.showUpNext) { Box( - modifier = Modifier - .align(Alignment.BottomEnd) - .padding(bottom = 120.dp, end = 24.dp) - .zIndex(2f), + modifier = bottomEndSlotModifier, contentAlignment = Alignment.BottomEnd, ) { IntroAutoSkipBanner(...) } } AnimatedVisibility( visible = state.showUpNext && state.nextEpisode != null, enter = fadeIn(), exit = fadeOut(), - modifier = Modifier - .align(Alignment.BottomEnd) - .padding(bottom = 120.dp, end = 24.dp) - .zIndex(2f), + modifier = bottomEndSlotModifier, ) { ... }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt` around lines 289 - 323, The intro-banner Box and the UpNextCard AnimatedVisibility in PlayerOverlay both repeat the same bottom-end positioning chain, so hoist that shared modifier into a single reusable val (for example a bottomEndSlotModifier near the overlay layout) and apply it to both IntroAutoSkipBanner and UpNextCard containers to keep the slot positioning consistent and easier to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt`:
- Around line 304-324: Keep nextEpisode available until the AnimatedVisibility
exit animation completes; currently advanceToNextEpisode()/loadContent clears
state.nextEpisode too early, so the UpNextCard can disappear before fadeOut
finishes. Update the PlayerOverlay flow so the visible flag is turned off first,
and defer clearing nextEpisode until after the exit transition (or when the
composable is fully dismissed), using the existing AnimatedVisibility,
state.nextEpisode, and UpNextCard paths.
---
Nitpick comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt`:
- Around line 289-323: The intro-banner Box and the UpNextCard
AnimatedVisibility in PlayerOverlay both repeat the same bottom-end positioning
chain, so hoist that shared modifier into a single reusable val (for example a
bottomEndSlotModifier near the overlay layout) and apply it to both
IntroAutoSkipBanner and UpNextCard containers to keep the slot positioning
consistent and easier to update.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/UpNextCard.kt`:
- Around line 74-80: The label for the next episode is being rebuilt inline in
UpNextCard instead of using the canonical NextEpisodeInfo.label, which can drift
from the shared format. Update the Text in UpNextCard to read from info.label
and remove the duplicated S{season}·E{episode} — {title} construction so the
screen stays consistent with NextEpisodeInfo.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0e0b3ad5-d8b6-4ae3-b858-b2f9371c3fc5
📒 Files selected for processing (7)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/UpNextCard.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/PlaybackSettings.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsViewModel.kt
| // F2: Up Next card — next-episode thumbnail/title/runtime with an | ||
| // auto-play countdown (null countdown = pass-out gated / auto-play off). | ||
| AnimatedVisibility( | ||
| visible = state.showNextEpisode, | ||
| visible = state.showUpNext && state.nextEpisode != null, | ||
| enter = fadeIn(), | ||
| exit = fadeOut(), | ||
| modifier = Modifier | ||
| .align(Alignment.BottomEnd) | ||
| .padding(bottom = 120.dp, end = 24.dp) | ||
| .zIndex(2f), | ||
| ) { | ||
| Button( | ||
| onClick = onNextEpisode, | ||
| colors = ButtonDefaults.buttonColors( | ||
| containerColor = MaterialTheme.colorScheme.primary, | ||
| ), | ||
| shape = RoundedCornerShape(8.dp), | ||
| ) { | ||
| Text("Next Episode") | ||
| state.nextEpisode?.let { next -> | ||
| UpNextCard( | ||
| info = next, | ||
| videoEnded = state.upNextVideoEnded, | ||
| countdownSeconds = state.upNextCountdownSeconds, | ||
| onPlayNow = viewModel::playUpNextNow, | ||
| onDismiss = viewModel::dismissUpNext, | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check whether advanceToNextEpisode / content-load reset clears nextEpisode
# in the same update as showUpNext, and confirm ordering.
rg -n -B3 -A15 'fun advanceToNextEpisode' androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
rg -n -B3 -A15 'nextEpisode\s*=\s*null' androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.ktRepository: Silo-Server/silo-android
Length of output: 2791
🏁 Script executed:
rg -n -B8 -A25 'fun playUpNextNow|private fun advanceToNextEpisode|fun loadContent\(' androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.ktRepository: Silo-Server/silo-android
Length of output: 4930
Keep nextEpisode alive through the exit transition. advanceToNextEpisode() hides the card, but loadContent() clears nextEpisode right after, so the AnimatedVisibility content can drop out before the fade-out finishes on both "Play Now" and auto-advance.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt`
around lines 304 - 324, Keep nextEpisode available until the AnimatedVisibility
exit animation completes; currently advanceToNextEpisode()/loadContent clears
state.nextEpisode too early, so the UpNextCard can disappear before fadeOut
finishes. Update the PlayerOverlay flow so the visible flag is turned off first,
and defer clearing nextEpisode until after the exit transition (or when the
composable is fully dismissed), using the existing AnimatedVisibility,
state.nextEpisode, and UpNextCard paths.
|
Closing this in favor of a consolidated parity/open-issues PR from fix/open-issues-upstream-main. The current branch already contains this work plus later followups. |
Summary
Adds the Up Next countdown card with auto-play to the phone player (
androidApp), porting the behavior already shipped on Android TV and iOS:PlayerViewModelresolves the next episode (current season, spilling into the next regular season), surfaces a non-modal Up Next card when playback crosses the credits marker — or, without a marker, thenextUpPromptSecondsfallback crossing — and auto-plays the next episode when playback actually ends, gated by theAutoPlayGuardpass-out streak and the per-profile auto-play setting.UpNextCard(phone-styled, bottom-right, non-modal) shows the next episode still/title/runtime with Play Now and dismiss actions; player gestures pass through to the player underneath.Two major audit findings against the initial cut were fixed in the follow-up commit:
STATE_ENDED(iOS parity). Previously a fixed 10s wall-clock timer could truncate up to ~110s of an episode with no credits marker. The 10s wall-clock countdown remains only for cards committed atSTATE_ENDED, where no playback is left to anchor to.seekImmediate) are unaffected.Verification
./gradlew :androidApp:assembleDebugpasses on this branch (TV module untouched).TvPlayerViewModel) and iOS (silo-applePlayerViewModel.swift) reference behavior, end-of-playback truncation, transport/countdown interaction, and Watch Together transport gating. The two major findings above were fixed; minor findings are listed as follow-ups below.Manual test checklist (maintainer)
STATE_ENDEDwith no earlier crossing (prompt seconds set to 0): card appears at the end with a 10s countdown, then advances.Skipped audit findings
None — both major findings were applied.
Follow-ups (minor review notes, not addressed here)
PlayerViewModel.kt~line 1221 — stalependingApproachingEndVideoEndedlatch: if the end crossing fires beforeresolveNextEpisode()completes and the user then seeks back out of the end window, a late resolve can still commit the card mid-episode. Clearing the pending flag on a user-initiated backward seek inonSeekwould close this. (Same pattern exists on TV, with a narrower window.)PlayerViewModel.kt~line 1301 — the Watch Together transport guard was dropped from the manual-advance path: the removedonNextEpisode()began withif (remoteTransportSuppressed) return, butplayUpNextNow()and the countdown-expiry advance never re-check it.onApproachingEnd()checks the flag only at commit time, so ifinWatchTogetherRoomflips true after the card is showing, local transport can drive inside a room. Low practical exposure (WT is not user-accessible on phone); re-checkingremoteTransportSuppressedinadvanceToNextEpisode()restores the invariant cheaply.PlayerViewModel.ktlines ~133/138/197 — dead public surface:NextEpisodeInfo.overview, the computedNextEpisodeInfo.label, andPlayerUiState.upNextCountdownTotalSecondshave no consumers.UpNextCard.ktre-derives theS{n}·E{n} — {title}label inline (with a slightly different null-title fallback) instead of usinginfo.label;upNextCountdownTotalSecondscopies TV's countdown-ring field without a phone consumer. Either wireUpNextCardtoinfo.labeland keep only what is displayed, or delete the unused members.PlayerViewModel.kt~line 1279 — the up-next end-of-playback state machine (pending latch,onApproachingEnd/commitApproachingEndsplit, countdown loop) is duplicated near-verbatim fromTvPlayerViewModel. Repo precedent extracts exactly this kind of logic (IntroAutoSkipControllerinshared/,AutoPlayGuardinandroid-shared/); worth extracting a small shared UpNext controller to avoid copy-divergence between the two apps.PlayerViewModel.kt~line 291 —nextUpPromptSecondsis a publicStateFlowbut its only reader is the ViewModel itself (the fallback crossing check); unlike the neighboringautoPlayNextEnabled(collected byPlayerOverlay), nothing outside the class consumes it — make it private.Closes #23
🤖 Generated with Claude Code
Summary by CodeRabbit