[Android] Add option for saving playback speed

Robert Stone git at videolan.org
Mon Dec 18 08:24:47 UTC 2023


vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Sun Dec 17 11:40:46 2023 -0800| [83a93605e06d58bd31cfe4267a8828bc5b5f9f93] | committer: Robert Stone

Add option for saving playback speed

> https://code.videolan.org/videolan/vlc-android/commit/83a93605e06d58bd31cfe4267a8828bc5b5f9f93
---

 application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt | 2 +-
 application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt       | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt b/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
index 52390733a9..208648721a 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaSessionCallback.kt
@@ -171,7 +171,7 @@ internal class MediaSessionCallback(private val playbackService: PlaybackService
             CUSTOM_ACTION_SPEED -> {
                 val steps = listOf(0.50f, 0.80f, 1.00f, 1.10f, 1.20f, 1.50f, 2.00f)
                 val index = 1 + steps.indexOf(steps.minByOrNull { abs(playbackService.rate - it) })
-                playbackService.setRate(steps[index % steps.size], false)
+                playbackService.setRate(steps[index % steps.size], true)
             }
             CUSTOM_ACTION_BOOKMARK -> {
                 playbackService.lifecycleScope.launch {
diff --git a/application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt b/application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
index ae8dd4ac05..1398cd0213 100644
--- a/application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
+++ b/application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
@@ -41,6 +41,7 @@ import androidx.core.content.edit
 import org.videolan.resources.AppContextProvider
 import org.videolan.tools.ENABLE_ANDROID_AUTO_SEEK_BUTTONS
 import org.videolan.tools.ENABLE_ANDROID_AUTO_SPEED_BUTTONS
+import org.videolan.tools.KEY_PLAYBACK_SPEED_PERSIST
 import org.videolan.tools.Settings
 import org.videolan.vlc.PlaybackService
 import org.videolan.vlc.R
@@ -111,6 +112,9 @@ class AutoControlScreen(carContext: CarContext) : Screen(carContext) {
 
     override fun onGetTemplate(): Template {
         val itemList = ItemList.Builder().apply {
+            addItem(buildToggleRow(R.string.playback_speed_title,
+                    R.string.playback_speed_summary,
+                    KEY_PLAYBACK_SPEED_PERSIST))
             addItem(buildToggleRow(
                     R.string.enable_android_auto_speed_buttons,
                     R.string.enable_android_auto_speed_buttons_summary,



More information about the Android mailing list