[Android] VideoPlayer: always remove audioFocus on stop
Thomas Guillem
git at videolan.org
Mon Mar 16 18:58:59 CET 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Mar 16 18:58:11 2015 +0100| [ab0bd67511b7bddc74170f908d183be8d4195235] | committer: Thomas Guillem
VideoPlayer: always remove audioFocus on stop
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ab0bd67511b7bddc74170f908d183be8d4195235
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 0c00afa..1ec3239 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -613,6 +613,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
protected void onStop() {
super.onStop();
+ changeAudioFocus(false);
mHandler.removeCallbacksAndMessages(null);
eventHandler.removeCallbacksAndMessages(null);
@@ -1239,9 +1240,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
mAudioManager.setParameters("bgm_state=true");
}
else {
- if (mAudioManager != null) {
+ if (mAudioManager != null && mAudioFocusListener != null) {
result = mAudioManager.abandonAudioFocus(mAudioFocusListener);
mAudioManager.setParameters("bgm_state=false");
+ mAudioFocusListener = null;
}
else
result = AudioManager.AUDIOFOCUS_REQUEST_FAILED;
More information about the Android
mailing list