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 {
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)

View file

@ -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)