react-native-audio-streaming icon indicating copy to clipboard operation
react-native-audio-streaming copied to clipboard

Android - Audio Focus Request & Wait

Open scgough opened this issue 7 years ago • 1 comments

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.

scgough avatar Oct 25 '17 15:10 scgough

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;

fidelsam1992 avatar Jul 31 '18 20:07 fidelsam1992