[Android] Always set playback rate

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| [d77a0e4b0889414a4d90de9e08120b226e813231] | committer: Robert Stone

Always set playback rate

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

 .../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 9cdb4f66ef..286baf199d 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -1102,8 +1102,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                         saveMediaMeta()
                     }
                 }
-                MediaPlayer.Event.SeekableChanged -> if (event.seekable && settings.getBoolean(if(player.isVideoPlaying()) KEY_PLAYBACK_SPEED_PERSIST_VIDEO else KEY_PLAYBACK_SPEED_PERSIST, false)) {
-                    player.setRate(settings.getFloat(if(player.isVideoPlaying()) KEY_PLAYBACK_RATE_VIDEO else KEY_PLAYBACK_RATE, 1.0f), false)
+                MediaPlayer.Event.SeekableChanged -> {
+                    val playbackRate = if (event.seekable && settings.getBoolean(if (player.isVideoPlaying()) KEY_PLAYBACK_SPEED_PERSIST_VIDEO else KEY_PLAYBACK_SPEED_PERSIST, false)) {
+                        settings.getFloat(if (player.isVideoPlaying()) KEY_PLAYBACK_RATE_VIDEO else KEY_PLAYBACK_RATE, 1.0f)
+                    } else 1.0f
+                    player.setRate(playbackRate, false)
                 }
                 MediaPlayer.Event.ESSelected -> {
                     getCurrentMedia()?.let { media ->



More information about the Android mailing list