[Android] Fix video start from non-Activity context

Geoffrey Métais git at videolan.org
Mon Dec 21 17:21:53 CET 2015


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 10 16:19:24 2015 +0100| [7e34356ecb00a519594e02242bc2510e6dfae689] | committer: Geoffrey Métais

Fix video start from non-Activity context

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 388cc60..5a25a74 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -21,6 +21,7 @@
 package org.videolan.vlc.gui.video;
 
 import android.annotation.TargetApi;
+import android.app.Activity;
 import android.app.KeyguardManager;
 import android.app.Presentation;
 import android.content.BroadcastReceiver;
@@ -925,8 +926,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         intent.putExtra(PLAY_EXTRA_ITEM_TITLE, title);
         intent.putExtra(PLAY_EXTRA_FROM_START, fromStart);
 
-        if (openedPosition != -1) {
-            intent.putExtra(PLAY_EXTRA_OPENED_POSITION, openedPosition);
+        if (openedPosition != -1 || !(context instanceof Activity)) {
+            if (openedPosition != -1)
+                intent.putExtra(PLAY_EXTRA_OPENED_POSITION, openedPosition);
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         }
         return intent;



More information about the Android mailing list