Merge pull request #2991 from Bnyro/master

Prevent controls from disappearing while scrubbing
This commit is contained in:
Bnyro 2023-02-07 19:42:29 +01:00 committed by GitHub
commit 45a8b9e21e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,7 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
import com.google.android.exoplayer2.ui.CaptionStyleCompat
import com.google.android.exoplayer2.ui.StyledPlayerView
import com.google.android.exoplayer2.ui.SubtitleView
import com.google.android.exoplayer2.ui.TimeBar
import com.google.android.exoplayer2.util.RepeatModeUtil
@SuppressLint("ClickableViewAccessibility")
@ -183,6 +184,19 @@ internal class CustomExoPlayerView(
}
})
// prevent the controls from disappearing while scrubbing the time bar
binding.exoProgress.addListener(object : TimeBar.OnScrubListener {
override fun onScrubStart(timeBar: TimeBar, position: Long) {
cancelHideControllerTask()
}
override fun onScrubMove(timeBar: TimeBar, position: Long) {
cancelHideControllerTask()
}
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {}
})
playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen ->
if (isFullscreen) {
windowHelper?.setFullscreen()