[Android] VideoPlayer: don't end activity when playing a playlist

Thomas Guillem git at videolan.org
Tue Aug 18 16:39:26 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Aug 18 16:38:05 2015 +0200| [bd90bf5017b884ac9cb46177aa3a1bb72e81a0a0] | committer: Thomas Guillem

VideoPlayer: don't end activity when playing a playlist

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java    |   12 +++++++++++-
 1 file changed, 11 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 4ec9e04..2586f81 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -234,6 +234,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private boolean mHardwareAccelerationError;
     private boolean mEndReached;
     private boolean mCanSeek;
+    private boolean mHasSubItems = false;
 
     // Playlist
     private int savedIndexPosition = -1;
@@ -1318,12 +1319,18 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 break;
             case Media.Event.MetaChanged:
                 break;
+            case Media.Event.SubItemTreeAdded:
+                mHasSubItems = true;
+                break;
         }
     }
 
     @Override
     public void onMediaPlayerEvent(MediaPlayer.Event event) {
         switch (event.type) {
+            case MediaPlayer.Event.Opening:
+                mHasSubItems = false;
+                break;
             case MediaPlayer.Event.Playing:
                 onPlaying();
                 break;
@@ -1334,7 +1341,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 exitOK();
                 break;
             case MediaPlayer.Event.EndReached:
-                endReached();
+                /* Don't end the activity if the media has subitems since the next child will be
+                 * loaded by the PlaybackService */
+                if (!mHasSubItems)
+                    endReached();
                 break;
             case MediaPlayer.Event.EncounteredError:
                 encounteredError();



More information about the Android mailing list