[Android] Open by default with AudioService

Thomas Guillem git at videolan.org
Thu Apr 9 18:16:15 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr  9 17:38:06 2015 +0200| [cd5b605b3beccd746e735668503fc118241e8963] | committer: Thomas Guillem

Open by default with AudioService

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

 vlc-android/src/org/videolan/vlc/util/Util.java |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 7a297a1..f1571e7 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -36,6 +36,8 @@ import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.VLCCallbackTask;
+import org.videolan.vlc.audio.AudioServiceController;
 import org.videolan.vlc.gui.video.VideoPlayerActivity;
 
 import android.annotation.TargetApi;
@@ -210,7 +212,21 @@ public class Util {
     }
 
     public static void openStream(Context context, final String uri){
-        VideoPlayerActivity.start(context, uri);
+        VLCCallbackTask task = new VLCCallbackTask(context){
+            @Override
+            public void run() {
+                AudioServiceController c = AudioServiceController.getInstance();
+
+                      /* Use the audio player by default. If a video track is
+                       * detected, then it will automatically switch to the video
+                       * player. This allows us to support more types of streams
+                       * (for example, RTSP and TS streaming) where ES can be
+                       * dynamically adapted rather than a simple scan.
+                       */
+                c.load(uri, false);
+            }
+        };
+        task.execute();
     }
 
     private static String getMediaString(Context ctx, int id) {



More information about the Android mailing list