Fix delayed ducking of Audio
Scenario: listening to a video on NewPipe over Bluetooth and a Notification Sound causes audio focus event AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK. Problem: With the current implementation animateAudio would cause the audio to reach the target volume AFTER the notification sound is played, which is irritating and annoying. Solution: animateAudio should just be used on focusGain where it is sensible to increase audio gradually. On ducking event the reaction should be immediate. This very simple fix does this. Please approve.
This commit is contained in:
parent
ce6a5ebf0a
commit
9437f057d0
|
@ -131,7 +131,7 @@ public class AudioReactor implements AudioManager.OnAudioFocusChangeListener,
|
||||||
private void onAudioFocusLossCanDuck() {
|
private void onAudioFocusLossCanDuck() {
|
||||||
Log.d(TAG, "onAudioFocusLossCanDuck() called");
|
Log.d(TAG, "onAudioFocusLossCanDuck() called");
|
||||||
// Set the volume to 1/10 on ducking
|
// Set the volume to 1/10 on ducking
|
||||||
animateAudio(player.getVolume(), DUCK_AUDIO_TO);
|
player.setVolume(DUCK_AUDIO_TO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateAudio(final float from, final float to) {
|
private void animateAudio(final float from, final float to) {
|
||||||
|
|
Loading…
Reference in New Issue