[Android] [PATCH 04/10] AudioService: handle media expansion

Edward Wang edward.c.wang at compdigitec.com
Wed Aug 29 04:21:52 CEST 2012


---
 vlc-android/src/org/videolan/vlc/AudioService.java |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index b948ac8..a45b767 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -295,8 +295,24 @@ public class AudioService extends Service {
                     break;
                 case EventManager.MediaPlayerEndReached:
                     Log.i(TAG, "MediaPlayerEndReached");
-                    service.executeUpdate();
-                    service.next();
+                    int p = LibVLC.getExistingInstance().expandMedia();
+                    if(p >= 0) {
+                        /* Sync the current media pointer and the current list */
+                        ArrayList<String> mediaList = new ArrayList<String>();
+                        LibVLC.getExistingInstance().getMediaListItems(mediaList);
+                        service.mMediaList.clear();
+                        for(int i = 0; i < mediaList.size(); i++)
+                            service.mMediaList.add(new Media(mediaList.get(i), i));
+                        service.mCurrentMedia = service.mMediaList.get(p);
+                        /* Expanding and playing a sub-item entails entry into
+                         * the playlist */
+                        service.mRealPlaylist = true;
+                        service.executeUpdate();
+                    } else {
+                        /* Business as usual */
+                        service.executeUpdate();
+                        service.next();
+                    }
                     break;
                 case EventManager.MediaPlayerVout:
                     if(msg.getData().getInt("data") > 0) {
-- 
1.7.5.4



More information about the Android mailing list