mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-24 03:36:51 +00:00
feat(player): add next episode overlay that appears 20s before episode end
Show an "Up Next" card with the next episode thumbnail, play overlay, and title when within 20 seconds of the current episode ending. Tapping it immediately starts the next episode from the playlist queue. - Add nextEpisode field to PlayerUiState derived from queue - Create NextEpisodeOverlay for mobile with artwork + title - Create TvNextEpisodeOverlay for TV with D-pad focus support - Integrate into both PlayerScreen and TvPlayerScreen - Auto-focus overlay on TV when it appears
This commit is contained in:
@@ -16,6 +16,7 @@ data class PlayerUiState(
|
||||
val chapters: List<TimedMarker> = emptyList(),
|
||||
val ads: List<TimedMarker> = emptyList(),
|
||||
val queue: List<PlaylistElementUiModel> = emptyList(),
|
||||
val nextEpisode: PlaylistElementUiModel? = null,
|
||||
val audioTracks: List<TrackOption> = emptyList(),
|
||||
val textTracks: List<TrackOption> = emptyList(),
|
||||
val qualityTracks: List<TrackOption> = emptyList(),
|
||||
|
||||
@@ -139,9 +139,16 @@ class PlayerViewModel @Inject constructor(
|
||||
playableMedia.toPlaylistElementUiModel(currentPlayableMedia?.id)
|
||||
}
|
||||
}.collect { queue ->
|
||||
val currentIndex = queue.indexOfFirst { it.isCurrent }
|
||||
val nextEpisode = if (currentIndex != -1 && currentIndex + 1 < queue.size) {
|
||||
queue[currentIndex + 1]
|
||||
} else {
|
||||
null
|
||||
}
|
||||
_uiState.update { state ->
|
||||
state.copy(
|
||||
queue = queue
|
||||
queue = queue,
|
||||
nextEpisode = nextEpisode
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user