我尝试将WebRTC from here集成到我的项目中
在第一个电话中一切正常,我有视频,但是在第二个电话和其他电话中没有。我尝试过
-socket.disconnect();
在VideoViewController中
deinit{
self.localVideoView = nil
self.webRTCClient.delegate = nil
}
在ViewController中断开连接,添加新按钮以进行连接,并添加其他按钮以断开连接:
@IBAction func connectBtn(_ sender: UIButton) {
self.webRTCClient.delegate = self
self.signalClient.delegate = self
self.hasLocalSdp = true
self.hasRemoteSdp = true
self.signalClient.connect()
}
@IBAction func disconnectBtn(_ sender: UIButton) {
self.webRTCClient.peerConnection.close()
self.signalingConnected = false
signalClient.socket.disconnect()
self.localCandidateCount = 0
self.remoteCandidateCount = 0
self.hasLocalSdp = false
self.hasRemoteSdp = false
}
在ViewWillAppear中添加委托(当关闭VideoViewController时,他们必须创建新的委托):
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
self.webRTCClient.remoteStream = nil
self.signalingConnected = false
self.hasLocalSdp = false
self.hasRemoteSdp = false
self.localCandidateCount = 0
self.remoteCandidateCount = 0
self.speakerOn = false
self.signalClient.connect()
self.webRTCClient.delegate = self
self.signalClient.delegate = self
}
对我没有帮助
“调试”区域中的链接 初次致电https://docs.google.com/document/d/1SpOm-udTvWYxVSVTBA4j4OKsIcNC9XiS1WmtnkIEhLo/edit?usp=sharing
第二https://docs.google.com/document/d/1TROAkqqOxVl9oTvsiD2WMzQccGBf2jtd6O3KVBCNdMc/edit?usp=sharing