我的应用程序从设备 A 调用设备 B。我第一次按下 CallKit 接受按钮时,两个设备都有声音。我注意到右上角的黄点首先出现在设备 B 上,然后出现在设备 A 上。
然后我挂断电话。两个黄点都消失了。然后我从 A 重拨到 B。问题是:有时 B 有声音,有时没有。更多的时候它没有。当黄点首先出现在B上时,它会发出声音;如果黄点先出现在A上,B就没有声音了。
黄点表示麦克风正在使用中。
我尝试了一些建议,例如延迟 1 秒回答: CallKit:No sound when I use WebRTC
症状仍然存在。
Peerconnection 在 EndCall 关闭并在 StartCall 创建。
有人可以提供一些见解吗/哪里可能出错?
-- 更多来自日志
// has sound if in this sequence
Received remote candidate (the last one)
reportNewIncomingCall( when ReceiveRemoteSdp of offer type)
didActivate audioSession
In CXAnswerCallAction
sendSDP in answer;
// has no sound if in this sequence
reportNewIncomingCall( when ReceiveRemoteSdp of offer type)
Received remote candidate (a bunch of)
In CXAnswerCallAction
sendSDP in answer
didActivate audioSession
有没有办法控制发送方和接收方,使序列像第一个/工作序列一样?
更新:
发现你必须确保在真正回答之前激活音频:
```
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
WebRTCClient.shared.answer { (localSdp) in
MySocket.shared.sendSDP(sdp: localSdp)
}
}