-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Description
According to Android documentation (https://developer.android.com/media/optimize/audio-focus#automatic-ducking), audio playback should be automatically ducked when another app requests audio focus with AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK, but this does not seem to be the case.
A workaround could have been to explicitly reduce the volume in response to a AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK event, but from what I see in https://github.com/software-mansion/react-native-audio-api/blob/1f342f3d3c23aec2357b0bd714bd17cb09f39426/packages/react-native-audio-api/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt, this type of event is ignored.
Steps to reproduce
- Play audio in an app using react-native-audio-api
- Open another app that you know will request audio focus with
AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK(best bet is a navigation app) and do whatever is needed to make it play a sound. - The first app continues to play audio at normal volume (expected behavior: continues to play but at reduced volume)
Snack or a link to a repository
https://snack.expo.dev/@dominique.lebrun/graceful-blue-croissant
React Native Audio API version
0.10.0
React Native version
0.81.5
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo Dev Client
Architecture
Fabric (New Architecture)
Build type
Release app & dev bundle
Device
Real device
Device model
No response
Acknowledgements
Yes