[Android] Preserve mime type on media launch from 3rd party

Geoffrey Métais git at videolan.org
Wed Jun 29 12:18:15 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 29 11:40:39 2016 +0200| [6090a7e3588a6e7fc80383ea7b812334ed5d4350] | committer: Geoffrey Métais

Preserve mime type on media launch from 3rd party

(cherry picked from commit de5af7dab6abefcbfecded7eaf1b4f1fd1049fe6)

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

 vlc-android/src/org/videolan/vlc/StartActivity.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 818f4c7..3d92a9d 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -57,19 +57,16 @@ 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));
-            if (intent.getType() != null && intent.getType().startsWith("video")) {
-                intent.setClass(this, VideoPlayerActivity.class);
-                startActivity(intent);
-            } else {
+            intent.setDataAndType(getUri(intent), intent.getType());
+            if (intent.getType() != null && intent.getType().startsWith("video"))
+                startActivity(intent.setClass(this, VideoPlayerActivity.class));
+            else
                 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
             startActivity(new Intent(this, VLCApplication.showTvUi() ? MainTvActivity.class : MainActivity.class));
         finish();
-        return;
     }
 
     private Uri getUri(Intent intent) {



More information about the Android mailing list