Search code examples
ioscallkit

How to control CallKit Speaker Button in ios 10


When I use CallKit in my project, I don't know how to control the speaker button. Other buttons like mute,hang up and so on can be control. When I test my project, I found that the 'AVAudioSession' instance is changed when I tap the speaker button, but the result is unsatisfactory. When I tap once, the speaker button is not changed selected status , sure, speaker is not opened. Twice the speaker button is changed to selected status. But the speaker effect seems to me very strange. I want to know the system mechanism of CallKit framework so that I can modify my code about 'AVAudioSession'. Thanks.


Solution

  • According to https://forums.developer.apple.com/thread/66308

    You will have to listen for audio route changes and perform speaker phone actions when the audio route changes to speaker mode.