[Android] Handle 3rd party apps calling for video playback

Geoffrey Métais git at videolan.org
Fri Mar 11 19:35:26 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 11 19:33:09 2016 +0100| [71b17cc97bad969faac728df6185f8b78b018254] | committer: Geoffrey Métais

Handle 3rd party apps calling for video playback

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

 vlc-android/src/org/videolan/vlc/StartActivity.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 9a991a2..189212d 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -38,6 +38,7 @@ import org.videolan.vlc.gui.AudioPlayerContainerActivity;
 import org.videolan.vlc.gui.MainActivity;
 import org.videolan.vlc.gui.tv.MainTvActivity;
 import org.videolan.vlc.gui.tv.audioplayer.AudioPlayerActivity;
+import org.videolan.vlc.gui.video.VideoPlayerActivity;
 import org.videolan.vlc.media.MediaUtils;
 import org.videolan.vlc.util.AndroidDevices;
 import org.videolan.vlc.util.Util;
@@ -56,8 +57,13 @@ public class StartActivity extends Activity {
         super.onCreate(savedInstanceState);
         Intent intent = getIntent();
         if (intent != null && TextUtils.equals(intent.getAction(), Intent.ACTION_VIEW) && intent.getData() != null) {
-            intent.setData(getUri(intent));
-            MediaUtils.openUri(this, intent.getData());
+            if (intent.getType().startsWith("video")) {
+                intent.setClass(this, VideoPlayerActivity.class);
+                startActivity(intent);
+            } else {
+                intent.setData(getUri(intent));
+                MediaUtils.openUri(this, 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



More information about the Android mailing list