mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
fix: can't resume playback at end of video
This commit is contained in:
parent
a59633a726
commit
2f89bf3756
@ -4,6 +4,8 @@ import androidx.media3.common.Player
|
|||||||
import com.github.libretube.helpers.PlayerHelper
|
import com.github.libretube.helpers.PlayerHelper
|
||||||
|
|
||||||
fun Player.togglePlayPauseState() {
|
fun Player.togglePlayPauseState() {
|
||||||
|
val minBufferingReached = totalBufferedDuration >= PlayerHelper.MINIMUM_BUFFER_DURATION
|
||||||
|
|| currentPosition + PlayerHelper.MINIMUM_BUFFER_DURATION >= duration
|
||||||
when {
|
when {
|
||||||
playerError != null -> {
|
playerError != null -> {
|
||||||
prepare()
|
prepare()
|
||||||
@ -14,7 +16,7 @@ fun Player.togglePlayPauseState() {
|
|||||||
seekTo(0)
|
seekTo(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
!isPlaying && totalBufferedDuration > PlayerHelper.MINIMUM_BUFFER_DURATION -> play()
|
!isPlaying && minBufferingReached -> play()
|
||||||
else -> pause()
|
else -> pause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user