[Android] Re-add setting for fast seek

Nicolas Pomepuy git at videolan.org
Mon Mar 7 14:04:58 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Mar  7 10:19:06 2022 +0100| [77d57603df5d9b6b7f0f35d1df41407405c6d7b1] | committer: Duncan McNamara

Re-add setting for fast seek

fixes #2415

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

 application/resources/src/main/res/values/strings.xml               | 2 ++
 application/vlc-android/res/xml/preferences_video.xml               | 6 ++++++
 application/vlc-android/src/org/videolan/vlc/PlaybackService.kt     | 3 ++-
 .../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt       | 2 +-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 75bad3269..6c1ee9caf 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -918,5 +918,7 @@
     <string name="view_online">View online</string>
     <string name="player_under_notch">Display video under notch</string>
     <string name="notch">Notch</string>
+    <string name="always_fast_seek">Always use fast seek</string>
+    <string name="always_fast_seek_summary">Seek is faster but may be less precise</string>
 
 </resources>
diff --git a/application/vlc-android/res/xml/preferences_video.xml b/application/vlc-android/res/xml/preferences_video.xml
index 640220e4d..6ca234acd 100644
--- a/application/vlc-android/res/xml/preferences_video.xml
+++ b/application/vlc-android/res/xml/preferences_video.xml
@@ -22,6 +22,12 @@
             android:key="playback_speed_video"
             android:summary="@string/playback_speed_summary"
             android:title="@string/playback_speed_title"/>
+    <CheckBoxPreference
+            app:singleLineTitle="false"
+            android:defaultValue="false"
+            android:key="always_fast_seek"
+            android:summary="@string/always_fast_seek_summary"
+            android:title="@string/always_fast_seek"/>
     <CheckBoxPreference
             app:singleLineTitle="false"
             android:defaultValue="true"
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index cf0fd5d71..e4a3d8e60 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -772,7 +772,8 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
     }
 
     fun setTime(time:Long, fast:Boolean = false) {
-        playlistManager.player.setTime(time, fast)
+        val shouldFast = fast || (!playlistManager.isBenchmark && settings.getBoolean("always_fast_seek", false))
+        playlistManager.player.setTime(time, shouldFast)
         publishState(time)
     }
 
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 920f7b542..c2f5c24ac 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -993,7 +993,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                 }
                 MediaPlayer.Event.TimeChanged -> {
                     abRepeat.value?.let {
-                        if (it.stop != -1L && player.getCurrentTime() > it.stop) player.setTime(it.start)
+                        if (it.stop != -1L && player.getCurrentTime() > it.stop) service.setTime(it.start)
                     }
                     if (player.getCurrentTime() % 10 == 0L) savePosition()
                 }



More information about the Android mailing list