[Android] Fix VideoPlayerActivity resume

Geoffrey Métais git at videolan.org
Thu Mar 24 16:40:22 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 24 16:39:44 2016 +0100| [049cb114bc0e5d47dfef4d9c35ba92f28698380f] | committer: Geoffrey Métais

Fix VideoPlayerActivity resume

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 190d5d9..f6fd00a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2717,7 +2717,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         if (intent.getData() != null)
             mUri = intent.getData();
-        if(extras != null) {
+        if (extras != null) {
             if (intent.hasExtra(PLAY_EXTRA_ITEM_LOCATION))
                 mUri = extras.getParcelable(PLAY_EXTRA_ITEM_LOCATION);
             fromStart = extras.getBoolean(PLAY_EXTRA_FROM_START, true);
@@ -2730,10 +2730,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (intent.hasExtra(PLAY_EXTRA_ITEM_TITLE))
             itemTitle = extras.getString(PLAY_EXTRA_ITEM_TITLE);
 
-        if (positionInPlaylist != -1) {
+        if (positionInPlaylist != -1 && mService.hasMedia()) {
             // Provided externally from AudioService
             Log.d(TAG, "Continuing playback from PlaybackService at index " + positionInPlaylist);
-            MediaWrapper openedMedia = mService.getCurrentMediaWrapper();
+            MediaWrapper openedMedia = mService.getMedias().get(positionInPlaylist);
             if (openedMedia == null) {
                 encounteredError();
                 return;
@@ -2749,7 +2749,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 mService.stop();
             // restore last position
             MediaWrapper media = MediaDatabase.getInstance().getMedia(mUri);
-            if(media != null) {
+            if (media != null) {
                 // in media library
                 if(media.getTime() > 0 && !fromStart && positionInPlaylist == -1) {
                     if (mAskResume) {



More information about the Android mailing list