From 162e1d4f9811f64f9f0e952ef850a92aa4614a63 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Mon, 30 Dec 2013 01:23:47 +0100 Subject: Applied bugfix from pull-request #313 --- .../service/playback/PlaybackServiceMediaPlayer.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java index 04c088d0d..6ab2c758b 100644 --- a/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java +++ b/src/de/danoeh/antennapod/service/playback/PlaybackServiceMediaPlayer.java @@ -4,8 +4,6 @@ import android.content.ComponentName; import android.content.Context; import android.media.AudioManager; import android.media.RemoteControlClient; -import android.os.Handler; -import android.os.Message; import android.util.Log; import android.util.Pair; import android.view.SurfaceHolder; @@ -689,11 +687,11 @@ public class PlaybackServiceMediaPlayer { case AudioManager.AUDIOFOCUS_GAIN: if (AppConfig.DEBUG) Log.d(TAG, "Gained audio focus"); - if (pausedBecauseOfTransientAudiofocusLoss) { + if (pausedBecauseOfTransientAudiofocusLoss) // we paused => play now + resume(); + else // we ducked => raise audio level back audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0); - resume(); - } break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: if (playerStatus == PlayerStatus.PLAYING) { @@ -702,7 +700,7 @@ public class PlaybackServiceMediaPlayer { Log.d(TAG, "Lost audio focus temporarily. Ducking..."); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0); - pausedBecauseOfTransientAudiofocusLoss = true; + pausedBecauseOfTransientAudiofocusLoss = false; } else { if (AppConfig.DEBUG) Log.d(TAG, "Lost audio focus temporarily. Could duck, but won't, pausing..."); -- cgit v1.2.3