You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alice 创建 RTCPeerConnection 对象,[将 iceServer 的信息作为参数传入, 此时这个对象会自动向服务器询问自己的公网 IP 和端口]
为该 RTCPeerConnection 对象绑定 icecandidate 事件,该事件在 ICE Server 添加到 RTCPeerConnection 对象时触发(An icecandidate event is fired when an RTCIceCandidate has been added to the target)
具体代码请参考 omegle,Chrome 实测可运行
WebRTC 是一个支持P2P分享应用数据和进行电话会议的实时通信技术,
socket.io 基于 WebSocket 提供浏览器于服务器之间的全双工通信
信令服务器
信令是用来协调沟通的。 为了使WebRTC实现P2P的连接,WebRTC的客户端需要相互交换信息。
offer, answer and candidate
RTCPeerConnection 是 WebRTC 应用用来传递元数据的API
本地媒体数据,例如分辨率,编码器和编码能力,这些元数据被用来供 offer 和 answer 使用
candidate 指的是 WebRTC 应用主机
Alice call Eve 的过程如下(必须先交换音视频信息,才会触发 icecandidate 事件):
取得本地流
navigator.webkitGetUserMedia
方法获得本地流addStream
方法添加到 RTCPeerConnection 需要发送的流音视频设备信息交换
网络信息交换
要点
RTCPeerConnection.createOffer
第三个参数接收options
, 需要设置The text was updated successfully, but these errors were encountered: