[Android] VideoPlayerActivity: readMedia should not be used for resuming playback

Ludovic Fauvet git at videolan.org
Thu Sep 27 14:18:24 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Sep 27 13:52:23 2012 +0200| [c4bfc5c5127c4dbad0187ba0637025a81533f335] | committer: Ludovic Fauvet

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.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c4bfc5c5127c4dbad0187ba0637025a81533f335
---

 .../src/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 7e481c4..2495e58 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)



More information about the Android mailing list