admin管理员组文章数量:1404557
I am trying to establish a p2p audio/video connection b/w two peers. Following: Getting started with WebRTC.
It works fine at my home in LAN Environment between 2 PCs, but throws an error message when running at my pany's LAN Environment, there is part the javascript
function processSignalingMessage(message) {
var msg = JSON.parse(message);
if (msg.type === 'offer') {
// Callee creates PeerConnection
if (!initiator && !started)
maybeStart();
// We only know JSEP version after createPeerConnection().
if (isRTCPeerConnection)
pc.setRemoteDescription(new RTCSessionDescription(msg));
else
pc.setRemoteDescription(pc.SDP_OFFER,
new SessionDescription(msg.sdp));
doAnswer();
} else if (msg.type === 'answer' && started) {
pc.setRemoteDescription(new RTCSessionDescription(msg));
} else if (msg.type === 'candidate' && started) {
var candidate = new RTCIceCandidate({
sdpMLineIndex : msg.label,
candidate : msg.candidate
});
pc.addIceCandidate(candidate);
} else if (msg.type === 'bye' && started) {
onRemoteHangup();
}
}
when the first user recieved message "type":"candidate",get wrong
and part of the console log:
- Creating PeerConnection
- Created webkitRTCPeerConnnection with config "{"iceServers":[{"url":"stun:stun.l.google:19302"}]}"
- Adding local stream
- Sending answer to peer
- recieved message : {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:1613033416 1 udp 2113937151 192.168.1.233 56946 typ host generation 0\r\n"}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
- recieved message : {"type":"candidat".......}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
- recieved message : {"type":"candidat".......}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
I am trying to establish a p2p audio/video connection b/w two peers. Following: Getting started with WebRTC.
It works fine at my home in LAN Environment between 2 PCs, but throws an error message when running at my pany's LAN Environment, there is part the javascript
function processSignalingMessage(message) {
var msg = JSON.parse(message);
if (msg.type === 'offer') {
// Callee creates PeerConnection
if (!initiator && !started)
maybeStart();
// We only know JSEP version after createPeerConnection().
if (isRTCPeerConnection)
pc.setRemoteDescription(new RTCSessionDescription(msg));
else
pc.setRemoteDescription(pc.SDP_OFFER,
new SessionDescription(msg.sdp));
doAnswer();
} else if (msg.type === 'answer' && started) {
pc.setRemoteDescription(new RTCSessionDescription(msg));
} else if (msg.type === 'candidate' && started) {
var candidate = new RTCIceCandidate({
sdpMLineIndex : msg.label,
candidate : msg.candidate
});
pc.addIceCandidate(candidate);
} else if (msg.type === 'bye' && started) {
onRemoteHangup();
}
}
when the first user recieved message "type":"candidate",get wrong
and part of the console log:
- Creating PeerConnection
- Created webkitRTCPeerConnnection with config "{"iceServers":[{"url":"stun:stun.l.google.:19302"}]}"
- Adding local stream
- Sending answer to peer
- recieved message : {"type":"candidate","label":0,"id":"audio","candidate":"a=candidate:1613033416 1 udp 2113937151 192.168.1.233 56946 typ host generation 0\r\n"}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
- recieved message : {"type":"candidat".......}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
- recieved message : {"type":"candidat".......}
- Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added
1 Answer
Reset to default 0I think you can create the ICE candidate message by using just the msg.candidate,
var candidate = new RTCIceCandidate(msg.candidate);
And pass that into the addIceCandidate
function
本文标签: javascriptWebRTC The ICE candidate could not be addedStack Overflow
版权声明:本文标题:javascript - WebRTC The ICE candidate could not be added - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744838828a2627796.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论