[Android] Revert "Restore correct audio volume after notifications"
Geoffrey Métais
git at videolan.org
Tue May 31 19:14:36 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 31 19:13:08 2016 +0200| [92596bf25547d1e005a9d1fe6393a66d4f8d025c] | committer: Geoffrey Métais
Revert "Restore correct audio volume after notifications"
This reverts commit 2ae42cb85835afd0c5f8a800e522a87901668d0b.
> https://code.videolan.org/videolan/vlc-android/commit/92596bf25547d1e005a9d1fe6393a66d4f8d025c
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 29d9433..f2b919b 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -353,7 +353,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
private OnAudioFocusChangeListener createOnAudioFocusChangeListener() {
return new OnAudioFocusChangeListener() {
private boolean mLossTransient = false;
- private int mLossTransientVolume = -1;
+ private boolean mLossTransientCanDuck = false;
private boolean wasPlaying = false;
@Override
@@ -381,15 +381,15 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
// Lower the volume
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.setVolume(36);
- mLossTransientVolume = mMediaPlayer.getVolume();
+ mLossTransientCanDuck = true;
}
break;
case AudioManager.AUDIOFOCUS_GAIN:
- Log.i(TAG, "AUDIOFOCUS_GAIN: " + mLossTransientVolume + ", " + mLossTransient);
+ Log.i(TAG, "AUDIOFOCUS_GAIN: " + mLossTransientCanDuck + ", " + mLossTransient);
// Resume playback
- if (mLossTransientVolume != -1) {
- mMediaPlayer.setVolume(mLossTransientVolume);
- mLossTransientVolume = -1;
+ if (mLossTransientCanDuck) {
+ mMediaPlayer.setVolume(100);
+ mLossTransientCanDuck = false;
} else if (mLossTransient) {
if (wasPlaying)
mMediaPlayer.play();
More information about the Android
mailing list