From 5724c894ca0fccfc2b906d90a4f899e594cc7c4a Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sat, 18 Jun 2022 17:18:25 +0200 Subject: [PATCH] Fixed online subs resetting progress --- .../cloudstream3/ui/player/CS3IPlayer.kt | 16 ++++++++++------ .../cloudstream3/ui/player/GeneratorPlayer.kt | 3 +-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt index 06a2c3a3..a5260e73 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt @@ -206,12 +206,15 @@ class CS3IPlayer : IPlayer { ) } else { when (subtitleHelper.subtitleStatus(subtitle)) { - SubtitleStatus.REQUIRES_RELOAD -> { - Log.i(TAG, "setPreferredSubtitles REQUIRES_RELOAD") - return@let true - // reloadPlayer(context) - } - SubtitleStatus.IS_ACTIVE -> { + + // Uncommenting this will lead to online subtitles resetting player to 00:00 on reload + +// SubtitleStatus.REQUIRES_RELOAD -> { +// Log.i(TAG, "setPreferredSubtitles REQUIRES_RELOAD") +// return@let true +// // reloadPlayer(context) +// } + SubtitleStatus.IS_ACTIVE, SubtitleStatus.REQUIRES_RELOAD -> { Log.i(TAG, "setPreferredSubtitles IS_ACTIVE") trackSelector.setParameters( @@ -519,6 +522,7 @@ class CS3IPlayer : IPlayer { mediaItem ) + println("PLAYBACK POS $playbackPosition") return exoPlayerBuilder.build().apply { setPlayWhenReady(playWhenReady) seekTo(currentWindow, playbackPosition) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt index d0d278f9..9691eec7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt @@ -375,8 +375,7 @@ class GeneratorPlayer : FullScreenPlayer() { setSubtitles(subtitleData) // this is used instead of observe, because observe is too slow - val subs = currentSubs.toMutableSet() - subs.add(subtitleData) + val subs = currentSubs + subtitleData player.setActiveSubtitles(subs) player.reloadPlayer(ctx)