[Android] Fix loading video from playlist

Geoffrey Métais git at videolan.org
Mon Mar 21 10:21:11 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 21 10:20:28 2016 +0100| [6e98b7c0aac082e839412bea51b5e5514b1c1b1e] | committer: Geoffrey Métais

Fix loading video from playlist

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 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 3d7d2db..783e34c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2687,7 +2687,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mUri = null;
         String title = getResources().getString(R.string.title);
         boolean fromStart = false;
-        int openedPosition = -1;
+        int positionInPlaylist = mService.getCurrentMediaPosition();
         Uri data;
         String itemTitle = null;
         long intentPosition = -1; // position passed in by intent (ms)
@@ -2722,9 +2722,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (intent.hasExtra(PLAY_EXTRA_ITEM_TITLE))
             itemTitle = extras.getString(PLAY_EXTRA_ITEM_TITLE);
 
-        if (openedPosition != -1) {
+        if (positionInPlaylist != -1) {
             // Provided externally from AudioService
-            Log.d(TAG, "Continuing playback from AudioService at index " + openedPosition);
+            Log.d(TAG, "Continuing playback from PlaybackService at index " + positionInPlaylist);
             MediaWrapper openedMedia = mService.getCurrentMediaWrapper();
             if (openedMedia == null) {
                 encounteredError();
@@ -2741,7 +2741,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             MediaWrapper media = MediaDatabase.getInstance().getMedia(mUri);
             if(media != null) {
                 // in media library
-                if(media.getTime() > 0 && !fromStart && openedPosition == -1) {
+                if(media.getTime() > 0 && !fromStart && positionInPlaylist == -1) {
                     if (mAskResume) {
                         showConfirmResumeDialog();
                         return;
@@ -2755,7 +2755,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
                 mLastAudioTrack = media.getAudioTrack();
                 mLastSpuTrack = media.getSpuTrack();
-            } else if (openedPosition == -1) {
+            } else if (positionInPlaylist == -1) {
                 // not in media library
 
                 if (intentPosition > 0 && mAskResume) {
@@ -2781,7 +2781,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             mService.addCallback(this);
             if (mService.isPlaying() && mService.getCurrentMediaWrapper().hasFlag(MediaWrapper.MEDIA_VIDEO)) {
                 onPlaying();
-            } else if (openedPosition == -1) {
+            } else if (positionInPlaylist == -1) {
                 /* prepare playback */
                 mService.stop();
                 final MediaWrapper mw = new MediaWrapper(mUri);
@@ -2796,7 +2796,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 mService.getCurrentMediaWrapper().addFlags(MediaWrapper.MEDIA_VIDEO);
                 // AudioService-transitioned playback for item after sleep and resume
                 if(!mService.isPlaying())
-                    mService.playIndex(openedPosition);
+                    mService.playIndex(positionInPlaylist);
                 else
                     onPlaying();
             }



More information about the Android mailing list