fix: reset episode stream state and hide panels on episode switch

This commit is contained in:
tapframe 2026-04-06 12:09:44 +05:30
parent e67bece53c
commit 27b162176a

View file

@ -546,6 +546,15 @@ fun PlayerScreen(
fun switchToEpisodeStream(stream: StreamItem, episode: MetaVideo) {
val url = stream.directPlaybackUrl ?: return
showNextEpisodeCard = false
showSourcesPanel = false
showEpisodesPanel = false
episodeStreamsPanelState = EpisodeStreamsPanelState()
nextEpisodeAutoPlayJob?.cancel()
nextEpisodeAutoPlaySearching = false
nextEpisodeAutoPlaySourceName = null
nextEpisodeAutoPlayCountdown = null
PlayerStreamsRepository.clearEpisodeStreams()
flushWatchProgress()
val epVideoId = episode.id
val epResumeVideoId = buildPlaybackVideoId(
@ -587,9 +596,6 @@ fun PlayerScreen(
activeVideoId = episode.id
activeInitialPositionMs = epResumePositionMs
activeInitialProgressFraction = null
showEpisodesPanel = false
episodeStreamsPanelState = EpisodeStreamsPanelState()
PlayerStreamsRepository.clearEpisodeStreams()
controlsVisible = true
}
@ -718,6 +724,10 @@ fun PlayerScreen(
previousIsPlaying = false
preferredAudioSelectionApplied = false
preferredSubtitleSelectionApplied = false
showSourcesPanel = false
showEpisodesPanel = false
episodeStreamsPanelState = EpisodeStreamsPanelState()
PlayerStreamsRepository.clearEpisodeStreams()
SubtitleRepository.clear()
WatchProgressRepository.ensureLoaded()
}