Botifier icon indicating copy to clipboard operation
Botifier copied to clipboard

AVCRP audio focus causes attenuation

Open Trinition opened this issue 10 years ago • 1 comments

I often listen to iHeartRadio. When a notification comes in, the iHeartRadio audio level attenuates while the notification ding plays. But the audio level never restores. My work-around is to stop/start iHeartReadio (or cycle bluetooth, or reboot, etc.).

I next found that Botifier attenuates the audio with Google Play Music as well as iheartradio.

Finally I found that if I set Botifier AVCRP plug-in to clear the notification after a timeout (e.g. 10s), the audio attenuation ended after that time.

I recently learned a little about Android audio focus, including ducking. I found in the Botifier code that it grabs audio focus with duckability (AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK). I suspect this might be the cause of the audio attenuation.

Why does Botifier need to grab audio focus? The system is handling the notification sound, right? And while the TTS module might need audio focus, that's not part of the AVCRP plug-in, but the TTS plug-in (which is not using).

Trinition avatar May 14 '15 00:05 Trinition

This is because the AVRCP information does not get pushed if the 'application' does not have audiofocus. In android 5.0 there is a whole new API to play with which should be able to prevent this. But in older version I dont thiink there is a way around this. Some applications (powerAmp) can ignore audioducking and keep playing at the same sound level.

Ill keep this issue open untill I make a release with the 5.0 code.

grimpy avatar May 15 '15 09:05 grimpy