RTCPeerConnections로 두 개의 피어를 연결하고 싶지만 Alice에서 Bob으로 IceCandidate를 추가 할 수 없습니다.
예:
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 버전 : 0.1.2.0_r30864 (Wed Dec 4 11:03:45 2013) on "linux_x64"
dartium : Chromium 31.0.1650.48
js-interop 라이브러리를 사용하여 해결 방법을 찾았습니다. 프록시를 사용하십시오.
import 'package:js/js.dart' as js;
// ...
_rpc = new js.Proxy(js.context.webkitRTCPeerConnection, js.map(iceServers));
// ...
var iceCandidate = new js.Proxy(js.context.RTCIceCandidate,
js.context.JSON.parse(/*your icecandidate string*/)
);
_rpc.addIceCandidate(iceCandidate);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다