[Android] Fix video player resume

Geoffrey Métais git at videolan.org
Wed Aug 30 13:50:57 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Aug 30 13:40:05 2017 +0200| [7e9f286b10656f60f000b60e163e7a2dcb305d30] | committer: Geoffrey Métais

Fix video player resume

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 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 13ec68e64..76663945e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -3250,11 +3250,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             // Start playback & seek
             mService.addCallback(this);
             /* prepare playback */
-            boolean hasMedia = mService.hasMedia();
-            if (hasMedia)
-                media = mService.getCurrentMediaWrapper();
-            else if (media == null)
-                media = new MediaWrapper(mUri);
+            final boolean hasMedia = mService.hasMedia();
+            final boolean medialoaded = media != null;
+            if (!medialoaded) {
+                if (hasMedia)
+                    media = mService.getCurrentMediaWrapper();
+                else
+                    media = new MediaWrapper(mUri);
+            }
             if (mWasPaused)
                 media.addFlags(MediaWrapper.MEDIA_PAUSED);
             if (intent.hasExtra(PLAY_DISABLE_HARDWARE))
@@ -3269,7 +3272,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
             // Handle playback
             if (!hasMedia) {
-                if (positionInPlaylist != -1)
+                if (!medialoaded && positionInPlaylist != -1)
                     mService.loadLastPlaylist(PlaybackService.TYPE_VIDEO);
                 else
                     mService.load(media);



More information about the Android mailing list