CallKit/detect speaker set on

Hi

CallKit works well for me so far.

CallKit provides

- (void)provider:(CXProvider *)provider performSetMutedCallAction:(CXSetMutedCallAction *)action;

to handle when the mute button is toggled on the iOS Incoming Call Screen.


however, it does not seem to provide a delegate when the user presses the Speaker Button


How can I handle this case to detect "Speaker On" event and at least update my own call UI (when the users chooses to open the app in-call) ?


best regards.

Would you be able to check the AVAudioSession.sharedInstance().currentRoute.outputs? The AVAudioSessionPortDescription will be able to tell you if it's configured for Speaker, so in your controllers viewWillAppear check the state and update the ui accordingly.


AVAudioSessionRouteDescription Example:


<AVAudioSessionRouteDescription: 0x17401a400,

inputs = (

"<AVAudioSessionPortDescription: 0x17401ee50, type = MicrophoneBuiltIn; name = iPod Microphone; UID = Built-In Microphone; selectedDataSource = (null)>"

);

outputs = (

"<AVAudioSessionPortDescription: 0x17001eb20, type = Speaker; name = Speaker; UID = Speaker; selectedDataSource = (null)>"

)>

There seems to be a bug with the speaker button in callkit. When you toggle it on/off, it updates the correct audio route, but does not update the state of the button. So you have to press it twice:

FB16380927

Hi @Brent-Envoy, we cannot read your feedback reports. Could you share if you got any reply/feedback from Apple, please? Thx.

CallKit/detect speaker set on
 
 
Q