[Android] fix paused video resumed when a new notification is received
Thomas Guillem
git at videolan.org
Mon Mar 16 18:22:05 CET 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Mar 16 18:10:33 2015 +0100| [33fbae7c1fecbc932ef9e9778bf030de23e5c095] | committer: Thomas Guillem
fix paused video resumed when a new notification is received
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=33fbae7c1fecbc932ef9e9778bf030de23e5c095
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 9 +++++++--
1 file changed, 7 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 324c79e..9f6e383 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -273,6 +273,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
* (e.g. lock screen, or to restore the pause state)
*/
private boolean mPauseOnLoaded = false;
+ private boolean mLostFocus = false;
// Tips
private View mOverlayTips;
@@ -1201,20 +1202,24 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
case AudioManager.AUDIOFOCUS_LOSS:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
- if (mLibVLC.isPlaying())
+ if (mLibVLC.isPlaying()) {
mLibVLC.pause();
+ mLostFocus = true;
+ }
break;
case AudioManager.AUDIOFOCUS_GAIN:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK:
- if (!mLibVLC.isPlaying())
+ if (!mLibVLC.isPlaying() && mLostFocus)
mLibVLC.play();
+ mLostFocus = false;
break;
}
}
};
}
+ mLostFocus = false;
int result;
if(acquire) {
result = mAudioManager.requestAudioFocus(mAudioFocusListener,
More information about the Android
mailing list