Fixed online subs resetting progress

This commit is contained in:
Blatzar 2022-06-18 17:18:25 +02:00
parent 86aed5b830
commit 5724c894ca
2 changed files with 11 additions and 8 deletions

View file

@ -206,12 +206,15 @@ class CS3IPlayer : IPlayer {
) )
} else { } else {
when (subtitleHelper.subtitleStatus(subtitle)) { when (subtitleHelper.subtitleStatus(subtitle)) {
SubtitleStatus.REQUIRES_RELOAD -> {
Log.i(TAG, "setPreferredSubtitles REQUIRES_RELOAD") // Uncommenting this will lead to online subtitles resetting player to 00:00 on reload
return@let true
// reloadPlayer(context) // SubtitleStatus.REQUIRES_RELOAD -> {
} // Log.i(TAG, "setPreferredSubtitles REQUIRES_RELOAD")
SubtitleStatus.IS_ACTIVE -> { // return@let true
// // reloadPlayer(context)
// }
SubtitleStatus.IS_ACTIVE, SubtitleStatus.REQUIRES_RELOAD -> {
Log.i(TAG, "setPreferredSubtitles IS_ACTIVE") Log.i(TAG, "setPreferredSubtitles IS_ACTIVE")
trackSelector.setParameters( trackSelector.setParameters(
@ -519,6 +522,7 @@ class CS3IPlayer : IPlayer {
mediaItem mediaItem
) )
println("PLAYBACK POS $playbackPosition")
return exoPlayerBuilder.build().apply { return exoPlayerBuilder.build().apply {
setPlayWhenReady(playWhenReady) setPlayWhenReady(playWhenReady)
seekTo(currentWindow, playbackPosition) seekTo(currentWindow, playbackPosition)

View file

@ -375,8 +375,7 @@ class GeneratorPlayer : FullScreenPlayer() {
setSubtitles(subtitleData) setSubtitles(subtitleData)
// this is used instead of observe, because observe is too slow // this is used instead of observe, because observe is too slow
val subs = currentSubs.toMutableSet() val subs = currentSubs + subtitleData
subs.add(subtitleData)
player.setActiveSubtitles(subs) player.setActiveSubtitles(subs)
player.reloadPlayer(ctx) player.reloadPlayer(ctx)