mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-08-16 04:18:08 +00:00
Merge 87dfe99c21 into 2fda777249
This commit is contained in:
commit
36f5a8438e
1 changed files with 16 additions and 0 deletions
|
|
@ -371,6 +371,22 @@ internal fun PlayerScreenRuntime.switchToDownloadedEpisode(downloadItem: Downloa
|
|||
}
|
||||
|
||||
internal fun PlayerScreenRuntime.playNextEpisode() {
|
||||
// If streams for the next episode are already loaded (e.g. autoplay found one
|
||||
// during its countdown), re-use them immediately instead of restarting the
|
||||
// entire search. This prevents a visible "Searching…" flicker when the user
|
||||
// manually taps the Next Episode button while the countdown is in progress.
|
||||
val nextVideoId = nextEpisodeInfo?.videoId
|
||||
val nextVideo = nextVideoId?.let { id -> playerMetaVideos.firstOrNull { it.id == id } }
|
||||
if (nextVideo != null && nextEpisodeInfo?.hasAired == true) {
|
||||
val cachedStreams = PlayerStreamsRepository.episodeStreamsState.value.groups
|
||||
.flatMap { it.streams }
|
||||
if (cachedStreams.isNotEmpty()) {
|
||||
nextEpisodeAutoPlayJob?.cancel()
|
||||
switchToEpisodeStream(cachedStreams.first(), nextVideo)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
scope.launchPlayerNextEpisodeAutoPlay(
|
||||
previousJob = nextEpisodeAutoPlayJob,
|
||||
nextEpisodeInfo = nextEpisodeInfo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue