[Android] Video/audio: don't handle focus of the other activity
Thomas Guillem
git at videolan.org
Thu Apr 9 18:16:14 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 9 17:23:37 2015 +0200| [e0647a975613fbd1d022dee88431cd238678c2f6] | committer: Thomas Guillem
Video/audio: don't handle focus of the other activity
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e0647a975613fbd1d022dee88431cd238678c2f6
---
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
*/
More information about the Android
mailing list