我想用 RTCPeerConnections 连接两个对等点,但我无法将 Alice 的 IceCandidate 添加到 Bob。
例子:
var alice = new RtcPeerConnection(
{"iceServers": [{"url": "stun:stun.l.google.com:19302"}]}
);
var bob = new RtcPeerConnection(
{"iceServers": [{"url": "stun:stun.l.google.com:19302"}]}
);
alice.createDataChannel("somelablel", {});
alice.onNegotiationNeeded.listen((var data){
alice.createOffer({}).then((var offer){
//got offer
alice.setLocalDescription(offer);
bob.setRemoteDescription(offer);
});
});
bob.onIceCandidate.listen((evt) {
if (evt.candidate)
print(evt.cancelable);
});
alice.onIceCandidate.listen((evt) {
if(evt.candidate != null)
//TODO: add iceCandidate to Bob
});
第一个版本(似乎很旧,但在在线示例中大量使用):
bob.addIceCandidate(candidatefromAlice);
输出:
Class 'RtcPeerConnection' has no instance method
'addIceCandidate' with matching arguments.
第二次尝试(带有 3 个参数的新版本):
bob.addIceCandidate(candidatefromAlice, (){}, (var error){
print(error.toString());
});
输出:
NotSupportedError: The implementation did not support the
requested type of object or operation. (Dartium)
我怎样才能在飞镖中毫无问题地设置 ICE 候选人?
信息:
Dart VM 版本:0.1.2.0_r30864(2013 年 12 月 4 日星期三 11:03:45)在“linux_x64”
dartium 上:Chromium 31.0.1650.48