[Android] Fix playback speed buttons when speed is < 0.25

Nicolas Pomepuy git at videolan.org
Wed Nov 13 13:01:04 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Nov  8 07:53:41 2024 +0100| [5d76c6f532c9d6ec14832fee2877f36dd40eeb74] | committer: Duncan McNamara

Fix playback speed buttons when speed is < 0.25

Fixes #3103

> https://code.videolan.org/videolan/vlc-android/commit/5d76c6f532c9d6ec14832fee2877f36dd40eeb74
---

 .../src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt         | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
index 0e60d521f3..c0619ed3b4 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PlaybackSpeedDialog.kt
@@ -62,7 +62,8 @@ class PlaybackSpeedDialog : VLCBottomSheetDialogFragment() {
             if (playbackService == null || playbackService!!.currentMediaWrapper == null)
                 return
             if (fromUser) {
-                val rate = (8.0).pow(progress.toDouble() / 100.0 - 1).toFloat()
+                val coef = if (progress < 100) 4.0 else 8.0
+                val rate = (coef).pow(progress.toDouble() / 100.0 - 1).toFloat()
                 playbackService!!.setRate(rate, true)
                 updateInterface()
             }
@@ -145,7 +146,8 @@ class PlaybackSpeedDialog : VLCBottomSheetDialogFragment() {
 
     private fun setRateProgress() {
         var speed = playbackService!!.rate.toDouble()
-        speed = 100 * (1 + ln(speed) / ln(8.0))
+        val coef = if (speed < 1.0) 4.0 else 8.0
+        speed = 100 * (1 + ln(speed) / ln(coef))
         binding.playbackSpeedSeek.progress = speed.toInt()
         updateInterface()
     }



More information about the Android mailing list