首页 > Web开发 > 详细

解决 flutter webrtc 有时候无法进行视频通话,但有时候又好使(前提:turn 和stun 已准备好)

时间:2021-04-27 20:06:03      阅读:31      评论:0      收藏:0      [点我收藏+]

现像:

   a和b通话的时候,有时候能通话,有时候不能通话,表现现象为 onIceConnectionState 的结果是failed 或者根本不调用onIceConnectionState 这个方法

   看日志,addIceCandidate ,和onIceCandidate 都是ok的,都有 typ relay类似的candidate

原因:

   暂时得出的结论是,不是任何时候调用peerConnection.addIceCandidate都有效,

   应该只有在IceGathering 开始后再调用addIceCandidate才可以。

解决方法:

监听onIceGatheringState,当值为RTCIceGatheringStateGathering的时候,把remote传过来的iceCandidate加到本地。即调用peerConnection.addCondidate
目前观测的是这样的结果,有可能不对,谨慎参考

解决 flutter webrtc 有时候无法进行视频通话,但有时候又好使(前提:turn 和stun 已准备好)

原文:https://www.cnblogs.com/zhangyy3/p/14710259.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!