[Android] [WIP PATCH 11/11] TEST

Thomas Guillem thomas at gllm.fr
Tue Dec 23 18:38:32 CET 2014


---
 .../src/org/videolan/vlc/gui/MainActivity.java     | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 8360f46..5d3392c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -26,6 +26,8 @@ import java.util.List;
 
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
+import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.MediaBrowser;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
@@ -133,6 +135,8 @@ public class MainActivity extends ActionBarActivity {
     private int mActionBarIconId = -1;
     Menu mMenu;
 
+    private MediaBrowser mMediaBrowser = null;
+    
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         /* Enable the indeterminate progress feature */
@@ -171,6 +175,52 @@ public class MainActivity extends ActionBarActivity {
         try {
             // Start LibVLC
             VLCInstance.getLibVlcInstance();
+            mMediaBrowser = new MediaBrowser(VLCInstance.getLibVlcInstance(), new MediaBrowser.Listener() {
+                
+                @Override
+                public void onMediaRemoved(int index) {
+                }
+                
+                @Override
+                public void onMediaAdded(final Media media, final int index) {
+                    try {
+                        Log.d(TAG, "onMediaAdded("+ index+"): " + media.getMrl() + " vs "+mMediaBrowser.getMediaAt(index).getMrl());
+                        if (media.getMrl().equals("smb://QUINCY"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/zappo"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/zappo/Videos"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/zappo/Videos/MPEG TS"))
+                            mMediaBrowser.browse(media);
+                        /*
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/audio"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/audio/lossless"))
+                            mMediaBrowser.browse(media);
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/audio/lossless/ALAC"))
+                            mMediaBrowser.browse(media);
+                        */
+                        /*
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples/audio/AbsoluteRadio.m3u"))
+                            mMediaBrowser.browse(media);
+                        */
+                        /*
+                        if (media.getMrl().equals("smb://QUINCY/Public/samples"))
+                            mMediaBrowser.browse(media);
+                        */
+                    } catch (LibVlcException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+                }
+            });
+            mMediaBrowser.browse("dsm");
+            //mMediaBrowser.browse("smb://QUINCY");
         } catch (LibVlcException e) {
             e.printStackTrace();
             Intent i = new Intent(this, CompatErrorActivity.class);
@@ -437,6 +487,8 @@ public class MainActivity extends ActionBarActivity {
     @Override
     protected void onDestroy() {
         super.onDestroy();
+        Log.e(TAG, "release");
+        mMediaBrowser.release();
 
         try {
             unregisterReceiver(messageReceiver);
-- 
2.1.3



More information about the Android mailing list