[Android] Pause media scan during playback

Geoffrey Métais git at videolan.org
Fri Sep 15 15:09:45 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep 15 14:56:43 2017 +0200| [c483d4f5b8c52fabc186086e8a4b3cf9a9885847] | committer: Geoffrey Métais

Pause media scan during playback

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java               | 3 +++
 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index a67be9000..68e095292 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -587,6 +587,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         public void onEvent(MediaPlayer.Event event) {
             switch (event.type) {
                 case MediaPlayer.Event.Playing:
+                    mMedialibrary.pauseBackgroundOperations();
                     mStopped = false;
                     loadMediaMeta();
                     if (mSavedTime > 0L) {
@@ -614,6 +615,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                         mMedialibrary.addToHistory(getCurrentMediaLocation(), getCurrentMediaWrapper().getTitle());
                     break;
                 case MediaPlayer.Event.Paused:
+                    mMedialibrary.resumeBackgroundOperations();
                     mStopped = false;
                     Log.i(TAG, "MediaPlayer.Event.Paused");
                     executeUpdate();
@@ -625,6 +627,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
                         mWakeLock.release();
                     break;
                 case MediaPlayer.Event.Stopped:
+                    mMedialibrary.resumeBackgroundOperations();
                     Log.i(TAG, "MediaPlayer.Event.Stopped");
                     onPlaybackStopped();
                     break;
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 209be4ec9..434f2bac5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -657,7 +657,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     @Override
     protected void onStart() {
         super.onStart();
-        mMedialibrary.pauseBackgroundOperations();
         mHelper.onStart();
         if (mSettings.getBoolean("save_brightness", false)) {
             float brightness = mSettings.getFloat("brightness_value", -1f);
@@ -680,7 +679,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     @Override
     protected void onStop() {
         super.onStop();
-        mMedialibrary.resumeBackgroundOperations();
         LocalBroadcastManager.getInstance(this).unregisterReceiver(mServiceReceiver);
 
         if (mBtReceiver != null)



More information about the Android mailing list