From c4bfc5c5127c4dbad0187ba0637025a81533f335 Mon Sep 17 00:00:00 2001
From: Ludovic Fauvet <etix@videolan.org>
Date: Thu, 27 Sep 2012 13:52:23 +0200
Subject: [PATCH] VideoPlayerActivity: readMedia should not be used for
 resuming playback

Unlike playIndex, readMedia adds the media to the VLC playlist (and thus
to the history) which is wrong in this case.
---
 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 7e481c420a..2495e5858d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1222,9 +1222,15 @@ public class VideoPlayerActivity extends Activity {
         }
 
         mSurface.setKeepScreenOn(true);
-        if (mLocation != null && mLocation.length() > 0 && !dontParse) {
+
+        /* Start / resume playback */
+        if (savedIndexPosition > -1) {
+            mLibVLC.playIndex(savedIndexPosition);
+        } else if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             savedIndexPosition = mLibVLC.readMedia(mLocation, false);
+        }
 
+        if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             // restore last position
             Media media = DatabaseManager.getInstance(this).getMedia(this, mLocation);
             if (media != null && media.getTime() > 0)
-- 
GitLab