【发布时间】:2013-12-05 15:43:55
【问题描述】:
我想用 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)
如何在 dart 中设置 ICE 候选人而不出现问题?
信息:
Dart VM 版本:“linux_x64”上的 0.1.2.0_r30864(2013 年 12 月 4 日星期三 11:03:45)
dartium : 铬 31.0.1650.48
【问题讨论】:
-
Dartium 版本不是很有帮助。 Darteditor>Help>About 菜单中的版本信息或
dart --version的输出更好 -
能否提供更多代码。什么是
bobsRtcPeerConnection,什么是candidatefromAlice? -
我添加了一些上下文。
-
这不是stackoverflow.com/questions/19896137/… 与引用的代码示例相同的问题吗?
-
我在旧版本中遇到了同样的错误。这个错误似乎是不同的(至少例外是)。
标签: exception dart webrtc dartium