Fix seek when playlist is not loaded

This commit is contained in:
Florian Renaud 2022-11-04 18:49:10 +01:00
parent a320155546
commit 43a112839f
1 changed files with 8 additions and 6 deletions

View File

@ -358,12 +358,14 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
playbackTicker = null
val totalDuration = playlist.duration
val playbackTime = playbackTracker.getPlaybackTime(id)
val remainingTime = totalDuration - playbackTime
if (remainingTime < 1000) {
playbackTracker.updatePausedAtPlaybackTime(id, 0, 0f)
} else {
playbackTracker.pausePlayback(id)
if (totalDuration > 0) {
val playbackTime = playbackTracker.getPlaybackTime(id)
val remainingTime = totalDuration - playbackTime
if (remainingTime < 1000) {
playbackTracker.updatePausedAtPlaybackTime(id, 0, 0f)
} else {
playbackTracker.pausePlayback(id)
}
}
}
}