Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Abnormal behavior of speaker button on system provided call screen

We write VoIP application using CallKit and PortSIP and here is a problem is reproduced only on iOS 11.2.x. When user taps speaker button on CallKit provided screen system enables speaker but icon remains in disabled state. If user taps again system also turns speaker on and forgets about button. To disable speaker user should tap button twice. Has anybody met this bug? And what was your solution? (:

Thanks.

like image 733
Alex Zaikin Avatar asked Dec 29 '17 13:12

Alex Zaikin


1 Answers

    RTCDispatcher.dispatchAsync(on: RTCDispatcherQueueType.typeAudioSession) {
        let audioSession = RTCAudioSession.sharedInstance()
        audioSession.lockForConfiguration()
        let configuration = RTCAudioSessionConfiguration.webRTC()
        configuration.categoryOptions = [AVAudioSessionCategoryOptions.allowBluetoothA2DP,AVAudioSessionCategoryOptions.duckOthers,
                                         AVAudioSessionCategoryOptions.allowBluetooth]
        try? audioSession.setConfiguration(configuration)
        audioSession.unlockForConfiguration()
    }

It helps me for CallKit. Speaker button works as expected.

like image 184
Алексей Смольский Avatar answered Oct 22 '22 08:10

Алексей Смольский