mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
fix: video can't be resumed after pausing it
This commit is contained in:
parent
f93f72e5a0
commit
5245e62f97
@ -1,11 +1,8 @@
|
||||
package com.github.libretube.extensions
|
||||
|
||||
import androidx.media3.common.Player
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
|
||||
fun Player.togglePlayPauseState() {
|
||||
val minBufferingReached = totalBufferedDuration >= PlayerHelper.MINIMUM_BUFFER_DURATION ||
|
||||
currentPosition + PlayerHelper.MINIMUM_BUFFER_DURATION >= duration
|
||||
when {
|
||||
playerError != null -> {
|
||||
prepare()
|
||||
@ -16,7 +13,7 @@ fun Player.togglePlayPauseState() {
|
||||
seekTo(0)
|
||||
}
|
||||
|
||||
!isPlaying && minBufferingReached -> play()
|
||||
!isPlaying -> play()
|
||||
else -> pause()
|
||||
}
|
||||
}
|
||||
|
@ -625,13 +625,7 @@ open class CustomExoPlayerView(
|
||||
}
|
||||
|
||||
override fun onDoubleTapCenterScreen() {
|
||||
player?.let { player ->
|
||||
if (player.isPlaying) {
|
||||
player.pause()
|
||||
} else {
|
||||
player.play()
|
||||
}
|
||||
}
|
||||
player?.togglePlayPauseState()
|
||||
}
|
||||
|
||||
override fun onDoubleTapLeftScreen() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user