[Android] Open audio from 3rd party without UI

Geoffrey Métais git at videolan.org
Wed Jul 6 11:53:58 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul  6 11:32:55 2016 +0200| [a17d47a64c5f5c8546f77343d8bcc7121ea46ee7] | committer: Geoffrey Métais

Open audio from 3rd party without UI

(cherry picked from commit 5006b7e448b4f40b3b00d5af68e69daf7cdcc161)

> https://code.videolan.org/videolan/vlc-android/commit/a17d47a64c5f5c8546f77343d8bcc7121ea46ee7
---

 vlc-android/src/org/videolan/vlc/StartActivity.java    | 2 +-
 vlc-android/src/org/videolan/vlc/media/MediaUtils.java | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 3d92a9d..241d5c6 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -61,7 +61,7 @@ public class StartActivity extends Activity {
             if (intent.getType() != null && intent.getType().startsWith("video"))
                 startActivity(intent.setClass(this, VideoPlayerActivity.class));
             else
-                MediaUtils.openUri(this, intent.getData());
+                MediaUtils.openMediaNoUi(intent.getData());
         } else if (intent != null && TextUtils.equals(intent.getAction(), AudioPlayerContainerActivity.ACTION_SHOW_PLAYER)) {
             startActivity(new Intent(this, VLCApplication.showTvUi() ? AudioPlayerActivity.class : MainActivity.class));
         } else
diff --git a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
index 8094bc8..282deed 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
@@ -91,6 +91,11 @@ public class MediaUtils {
         });
     }
 
+    public static void openMediaNoUi(Uri uri){
+        final MediaWrapper media = new MediaWrapper(uri);
+        openMediaNoUi(VLCApplication.getAppContext(), media);
+    }
+
     public static void openMediaNoUi(final Context context, final MediaWrapper media){
         if (media == null)
             return;



More information about the Android mailing list