[Android] [PATCH 18/24] AudioService: handle media expansion

Edward Wang edward.c.wang at compdigitec.com
Wed Aug 22 23:15:18 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 678a802..63ccf7f 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -289,8 +289,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