系统提供的呼叫屏幕上扬声器按钮的异常行为

Ale*_*kin 5 voip ios swift callkit portsip

我们使用CallKit和PortSIP编写VoIP应用程序,这是一个仅在iOS 11.2.x上重现的问题.当用户点击CallKit上的扬声器按钮时,屏幕系统启用扬声器,但图标仍处于禁用状态.如果用户再次点击,系统也会打开扬声器并忘记按钮.要禁用扬声器用户,请按两次按钮.有人遇到过这个bug吗?你的解决方案是什么?(:

谢谢.

Але*_*кий 8

    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()
    }
Run Code Online (Sandbox Code Playgroud)

它对CallKit有帮助。扬声器按钮按预期方式工作。

  • ````试试?AVAudioSession.sharedInstance().setCategory( AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.voiceChat, options: [.duckOthers, .allowBluetoothA2DP, .allowBluetooth] )``` 我在所有项目中都使用它。也许之后有人更改了 AVAudioSession (2认同)

RJV*_*mar 0

以前的版本也遇到过同样的问题。所以这不是呼叫套件上发生的新问题。

这个问题必须从 iOS 来解决。我们对此没有任何控制权。