WebRTC第二次通话后无视频

时间:2018-09-17 08:46:49

标签: ios swift xcode webrtc

我尝试将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

0 个答案:

没有答案