[Android] [PATCH 1/5] Video : Always pause video if activity has stopped
Alexandre Perraud
4leyx4ndre at gmail.com
Thu Sep 11 19:40:18 CEST 2014
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 13 +++++++++++++
1 file changed, 13 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 ecd28ce..66d2d0e 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) {
@@ -500,6 +503,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
mPresentation.dismiss();
mPresentation = null;
}
+
+ mHasStopped = true;
}
@Override
@@ -853,6 +858,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
activity.setESTracks();
activity.changeAudioFocus(true);
activity.updateNavStatus();
+ activity.pauseIfHasStopped();
break;
case EventHandler.MediaPlayerPaused:
Log.i(TAG, "MediaPlayerPaused");
@@ -1796,6 +1802,13 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
mSurface.setKeepScreenOn(false);
}
+ private void pauseIfHasStopped() {
+ if (mHasStopped) {
+ mHasStopped = false;
+ pause();
+ }
+ }
+
/**
* External extras:
* - position (long) - position of the video to start with (in ms)
--
1.9.1
More information about the Android
mailing list