[Android] [PATCH 1/3] Video/audio: don't handle focus of the other activity
Thomas Guillem
thomas at gllm.fr
Thu Apr 9 17:45:48 CEST 2015
---
vlc-android/src/org/videolan/vlc/audio/AudioService.java | 2 ++
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 ++
2 files changed, 4 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index 090ef6f..c09244d 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -322,6 +322,8 @@ public class AudioService extends Service {
audioFocusListener = new OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
+ if (!hasCurrentMedia())
+ return;
switch (focusChange)
{
case AudioManager.AUDIOFOCUS_LOSS:
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 b3aa1d8..84852f7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1318,6 +1318,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
new OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
+ if (!mPlaybackStarted)
+ return;
/*
* Pause playback during alerts and notifications
*/
--
2.1.3
More information about the Android
mailing list