From 92c60302e823964f96d7e61ab6a5aa971ee94ab6 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 8 Dec 2022 18:21:56 +0100 Subject: [PATCH] remember the playback speed per session --- .../libretube/ui/views/CustomExoPlayerView.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 6d73d0f16..5ce834441 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 @@ -76,6 +76,9 @@ internal class CustomExoPlayerView( if (isControllerFullyVisible) hideController() else showController() } + // saved to only load the playback speed once (for the first video) + private var playbackPrefSet = false + fun initialize( playerViewInterface: OnlinePlayerOptions?, doubleTapOverlayBinding: DoubleTapOverlayBinding, @@ -98,10 +101,13 @@ internal class CustomExoPlayerView( initializeAdvancedOptions(context) - player?.playbackParameters = PlaybackParameters( - PlayerHelper.playbackSpeed.toFloat(), - 1.0f - ) + if (!playbackPrefSet) { + player?.playbackParameters = PlaybackParameters( + PlayerHelper.playbackSpeed.toFloat(), + 1.0f + ) + playbackPrefSet = true + } // locking the player binding.lockPlayer.setOnClickListener {