fix(ios,android): offer the right episode as up next while the next one opens

After "next episode" during the credits, the previous file keeps
playing until the new stream is open. Its chapters and position were
read against the already-advanced index, so the up-next card offered
the episode after the next one for those seconds. The card, the skip
offer and auto-skip now only act on readings of the open episode.
This commit is contained in:
nvrl committed 2026-10-12 18:36:33 +02:00
1 parent 73973841c2
commit 0b9a9dab50
3 files changed
+16 -5

No files matched your search

@@ -333,7 +333,12 @@ fun PlayerScreen(
val problem by nativeHost.problem.collectAsState()
LaunchedEffect(problem) { problem?.let { playbackError = it } }
val offer = remember(chapters, key, (state.position * 4).roundToInt()) {
// Whether mpv's readings are this episode's. Not while the next one opens:
// the last one's credits play on until it is loaded, and read against the
// new index they offered the episode after the next as up next.
val playingThis = state.media == key
val offer = remember(chapters, key, playingThis, (state.position * 4).roundToInt()) {
if (!playingThis) return@remember null
runCatching { skipOffer(chapters, state.position) }.getOrNull()
}
// Auto-skip is offered once per chapter: seeking back into an opening on
@@ -475,7 +480,7 @@ fun PlayerScreen(
UpNextCard(
next = next,
visible = autoplay && !state.paused &&
visible = autoplay && !state.paused && playingThis &&
chapters.creditsStart?.let { state.position >= it } == true,
onPlayNow = { advance() },
modifier = Modifier