[Android] Playback: Reset playback rate on new playback

Geoffrey Métais git at videolan.org
Thu Feb 21 09:36:18 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 21 09:22:46 2019 +0100| [3ef58b8ff07e5ac91b28c50b0cc53b51c59fc592] | committer: Geoffrey Métais

Playback: Reset playback rate on new playback

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 --
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt           | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d61f1d1e5..96dafd318 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -784,8 +784,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
             if (length - mSavedTime < 5000) mSavedTime = 0;
             else mSavedTime -= 2000; // go back 2 seconds, to compensate loading time
         }
-
-        mService.setRate(1.0f, false);
         mService.stop();
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 814d51240..ebb7530a4 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -129,6 +129,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
             mediaList.addEventListener(this at PlaylistManager)
             stopAfter = -1
             clearABRepeat()
+            player.setRate(1.0f, false)
             playIndex(currentIndex)
             onPlaylistLoaded()
             if (mlUpdate) {
@@ -791,6 +792,9 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                         if (it.stop != -1L && player.getCurrentTime() > it.stop) player.seek(it.start)
                     }
                 }
+                MediaPlayer.Event.SeekableChanged -> if (event.seekable && settings.getBoolean(PreferencesActivity.KEY_PLAYBACK_SPEED_PERSIST, false)) {
+                    player.setRate(settings.getFloat(PreferencesActivity.KEY_PLAYBACK_RATE, 1.0f), false)
+                }
             }
             service.onMediaPlayerEvent(event)
         }



More information about the Android mailing list