react-native-audio-streaming
react-native-audio-streaming copied to clipboard
Android - Audio Focus Request & Wait
I noticed that on Android, sound can overlap between applications so this addition will use AudioManager
to request audio focus and play the sound after it has been granted.
Thank you for this PR it is really helpful.
In case you also need to resume the streaming automatically after the call is done, or the other app using audio is closed. Use this code below under in file ReactNativeAudioStreamingModule.java
case (AudioManager.AUDIOFOCUS_GAIN) :
// Return the volume to normal and resume if paused.
playInternal();
break;
default: break;