一.webrtc解决了P2P透传
二.解决web端无摄像头的问题
三.解决https的问题,可以使用http查看
流程
1.首先建立WebSocket连接
2. 通过ws发送 open msg 到服务器
3. 获取ws服务返回的 msg中获取摄像头是否在线
4. 如果在线 则发送call 信息到服务器
5. 接收到ws服务返回的 offer, offer中需要返回sdp信息
6. 使用iceServers创建PeerConnection,
设置PeerConnection的回调
PeerConnection.ontrack = handleRemoteTrackAdded;
PeerConnection.onicecandidate = handleIceCandidate;
7.给PeerConnection 设置setRemoteDescription
PeerConnection.setRemoteDescription(new nativeRTCSessionDescription(offer中的sdp));
8.handleRemoteTrackAdded中获取stream[0],然后使用video播放
9.PeerConnection创建answer成功回调后发送answer,answer发送创建answer返回的sdp
10.ice回调handleIceCandidate触发,和stun服务器完成了信令交换,获取了外网ip
11.发送 icecandidate 到 ws服务器,candidate在handleIceCandidate中返回;
12.获取ws服务器返回的_ice_candidate 信息;
然后生成candidate,然后再通过PeerConnection.addIceCandidate(candidate)
//流程结束
//代码不贴了,有问题再回复