From 0821ac66db99a857bb24e3b0b0b5b8ec1469c3ff Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 7 Feb 2023 19:42:08 +0100 Subject: [PATCH] Prevent controls from disappearing while scrubbing --- .../libretube/ui/views/CustomExoPlayerView.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 557442136..ff4d54a80 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -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()