react-native-incall-manager
react-native-incall-manager copied to clipboard
Audio not routing to speaker by default when the auto settings are true
In my application, I have the media set to audio
and auto is true
, which means I am using the Automatic behaviour, but as soon as I start the call, my audio is not routed through the speaker but through an earpiece by default and it doesn't change even if I take the proximity benefits and bring my phone near to my ears.
My code looks like this:
InCallManager.start({ media: 'audio', auto: true });
// Added this because of https://github.com/react-native-webrtc/react-native-incall-manager/issues/82#issuecomment-385241109
if (Platform.OS === 'ios') {
NativeModules.InCallManager.addListener('Proximity');
}
DeviceEventEmitter.addListener('Proximity', function (data) {
if (data.isNear) {
InCallManager.setSpeakerphoneOn(false);
} else {
InCallManager.setSpeakerphoneOn(true);
}
});
Note: Routing through Bluetooth devices works fine, but the speaker isn't working.
Expected behaviour: The audio should be routed through the speaker if no Bluetooth device is connected, and the audio should only route through the earpiece if it's brought near the ears, not by default.