Open wilmxre opened 12 months ago
Same to me. When coming from a call, the speaker dont back to on. I noticed that on Android 11 this works normally, on Android 12 the problem occurs. Any solution?
i did two things:
onIceCompleted
, when that fired i called IncallManager.start({media:'video'})
In my case, I listener an Device event emitter when the audio focus coming back to my app and set speaker to true, example:
DeviceEventEmitter.addListener('onAudioFocusChange', function (data) {
// --- do something with events
switch (data?.eventText) {
case 'AUDIOFOCUS_GAIN':
InCallManager.setSpeakerphoneOn(true)
break;
default:
break;
}
})
This is not a bug, but rather a standard behavior of the operating system.
My scenario is the following:
I am using
react-native-incall-manager
withreact-native-callkeep
.When initiating an outgoing video call i am calling
InCallManager.start({ media: 'video', auto: true, ringback: '_BUNDLE_', });
in CallKeep'sdidActivateAudioSession
event, which plays a ringback sound, then when the video call is connected the audio is playing through the speakers, at is should.But on incoming calls, when the call is answered the video call is playing through the earpiece. On CallKeep's
showIncomingCallUi
event i am callingInCallManager.start({ media: 'video' });
, to have all the events around the video call be handled automatically by IncallManager.I think the issue might happen because IncallManager is used with CallKeep and maybe there are some overriding issues.
These are my logs, starting from when the incoming call is first registered to when the video call was answered and connected:
As you can see in
the speaker is selected and the audio device is updated, but the audio is still not routed to the speakers, despite the logs.
p.s.
--hasEarpiece: NO
is because i hardcodedhasEarpiece()
return value to false, to make it impossible to route it to the earpieceI tried calling
IncallManager.setForceSpeakerPhoneOn
right afterIncallManager.start({ media: 'video' })
, that gave meso for some reason, on incoming call the SPEAKER_PHONE is not available.
I event tried calling CallKeep's
toggleAudioRouteSpeaker
, but that didn't help either.I would take any advice happily.