在标准规范中,它说您可以将ENUM值设置为“relay”:http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCIceServer
但是,如何使用以下Javascript将枚举设置为“relay”?
还是这是个BUG?https://code.google.com/p/webrtc/issues/detail?id=1179 有什么想法。
if (tmp.indexOf("typ relay ") >= 0) {
在我的测试中从未发生。我如何强制它转换为枚举“relay”?还是这是个BUG?https://code.google.com/p/webrtc/issues/detail?id=1179 有什么想法。
function createPeerConnection() {
try {
// Create an RTCPeerConnection via the polyfill (adapter.js).
pc = new RTCPeerConnection(pcConfig, pcConstraints);
pc.onicecandidate = onIceCandidate;
console.log('Created RTCPeerConnnection with:\n' +
' config: \'' + JSON.stringify(pcConfig) + '\';\n' +
' constraints: \'' + JSON.stringify(pcConstraints) + '\'.');
} catch (e) {
console.log('Failed to create PeerConnection, exception: ' + e.message);
alert('Cannot create RTCPeerConnection object; \
WebRTC is not supported by this browser.');
return;
}
pc.onaddstream = onRemoteStreamAdded;
pc.onremovestream = onRemoteStreamRemoved;
pc.onsignalingstatechange = onSignalingStateChanged;
pc.oniceconnectionstatechange = onIceConnectionStateChanged;
}
function onIceCandidate(event) {
if (event.candidate) {
var tmp = event.candidate.candidate;
if (tmp.indexOf("typ relay ") >= 0) {
/////////////////////////////////////////// NEVER happens
sendMessage({type: 'candidate',
label: event.candidate.sdpMLineIndex,
id: event.candidate.sdpMid,
candidate: tmp});
noteIceCandidate("Local", iceCandidateType(tmp));
}
} else {
console.log('End of candidates.');
}
}