[Android] [PATCH] Video : Always pause video if activity has stopped

Alexandre Perraud 4leyx4ndre at gmail.com
Fri Aug 22 17:49:54 CEST 2014


    fix #10015
---
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java       | 8 ++++++++
 1 file changed, 8 insertions(+)

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 69b318c..67411ed 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -241,6 +241,9 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
     private boolean mHasMenu = false;
     private boolean mIsNavMenu = false;
 
+    // Check if VideoPlayerActivity has stopped
+    private boolean mHasStopped = false;
+
     @Override
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     protected void onCreate(Bundle savedInstanceState) {
@@ -504,6 +507,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
             mPresentation.dismiss();
             mPresentation = null;
         }
+        mHasStopped = true;
     }
 
     @Override
@@ -857,6 +861,10 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
                     activity.setESTracks();
                     activity.changeAudioFocus(true);
                     activity.updateNavStatus();
+                    if (activity.mHasStopped) {
+                        activity.mHasStopped = false;
+                        activity.pause();
+                    }
                     break;
                 case EventHandler.MediaPlayerPaused:
                     Log.i(TAG, "MediaPlayerPaused");
-- 
1.9.1



More information about the Android mailing list