[Android] Workaround to load playlists from 3rd party apps

Geoffrey Métais git at videolan.org
Thu Aug 6 16:25:04 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug  6 16:24:20 2015 +0200| [924363bf1f04a35aad0be85ea47106eec4221004] | committer: Geoffrey Métais

Workaround to load playlists from 3rd party apps

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

 .../videolan/vlc/gui/video/VideoPlayerActivity.java    |   16 ++++++++++++----
 1 file changed, 12 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 0e123cb..9192011 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -102,10 +102,10 @@ import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
-import org.videolan.vlc.gui.browser.FilePickerActivity;
-import org.videolan.vlc.gui.PlaybackServiceActivity;
 import org.videolan.vlc.gui.MainActivity;
+import org.videolan.vlc.gui.PlaybackServiceActivity;
 import org.videolan.vlc.gui.PreferencesActivity;
+import org.videolan.vlc.gui.browser.FilePickerActivity;
 import org.videolan.vlc.gui.dialogs.AdvOptionsDialog;
 import org.videolan.vlc.interfaces.IDelayController;
 import org.videolan.vlc.util.AndroidDevices;
@@ -1315,11 +1315,16 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         }
     }
 
+    //FIXME hack to workaround playlist loading fail.
+    boolean mIgnorePlaylistEnd = false;
     @Override
     public void onMediaPlayerEvent(MediaPlayer.Event event) {
         switch (event.type) {
             case MediaPlayer.Event.Playing:
-                onPlaying();
+                if (mService.getCurrentMediaWrapper().getType() == MediaWrapper.TYPE_PLAYLIST){
+                    mIgnorePlaylistEnd = true;
+                } else
+                    onPlaying();
                 break;
             case MediaPlayer.Event.Paused:
                 updateOverlayPausePlay();
@@ -1328,7 +1333,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 exitOK();
                 break;
             case MediaPlayer.Event.EndReached:
-                endReached();
+                if(mIgnorePlaylistEnd)
+                    mIgnorePlaylistEnd = false;
+                else
+                    endReached();
                 break;
             case MediaPlayer.Event.EncounteredError:
                 encounteredError();



More information about the Android mailing list