问题
Before we start: I had to change "http;//" to "http;//" (this is not a bug in my code). I am trying to create a WebRTC video & audio connection and try to use ajax and a database for signaling. But I always get this info in the console: "OperationError: Unknown ufrag (71c0b048)"
It does not matter if I do it on the same computer (two tabs in Firefox or a tab in private mode, one in "normal" mode or two different computers on the same connection or one teathering using my smartphone).
Here is my code:
/* ``` */
var opt;
var video_el_partner;
var video_el_local;
var peer_con;
var interval_gro;
var interval_gra;
var interval_grc;
var remote_offer_available = false;
var interval_time = 3000;
var already_used_can = new Object();
var remote_desc_set = false;
var service_url = "https;//xyz.de/webrtc";
var pwd = "xxx";
var signaling_url = "https;//xyz.de/webrtc/sdp_transfer.php";
var ice_setup = null;
ice_setup = {
'iceServers': [{'urls': 'stun:stun.schlund.de'}, {'urls': 'stun:iphone-stun.strato-iphone.de:3478'}]
};
function init_stream(video_partner_id, video_local_id, allow_video, allow_audio){
if (location.protocol === 'https:') { // only possible for https!
peer_con = new RTCPeerConnection(ice_setup);
if(document.getElementById(video_partner_id) != null && document.getElementById(video_local_id) != null){
video_el_partner = document.getElementById(video_partner_id);
video_el_local = document.getElementById(video_local_id);
if(allow_video == null){
allow_video = true;
}
if(allow_audio == null){
allow_audio = true;
}
opt = { audio: allow_audio, video: allow_video };
if(typeof navigator != 'undefined' && typeof navigator.mediaDevices != 'undefined' && navigator.mediaDevices.getUserMedia != null){
navigator.mediaDevices.getUserMedia(opt).then (
function (this_stream){
// local video directly into video element:
video_el_local.srcObject = this_stream;
// remote one is more insteresting:
peer_con.addStream(this_stream);
peer_con.createOffer().then(
function (this_sdp) {
// sdp (session dependend protocol object) is now available... this would need to go to a server somehow now.
// they use socket.io for that... maybe I can use my own thing to do that?
peer_con.setLocalDescription(this_sdp);
var this_sdp_json = JSON.stringify(this_sdp)
var params_ins = "mode=insert_offer&sdp_con=" + this_sdp_json + "&pass=" + pwd + "&service_url=" + service_url;
ajax_request_simple (
signaling_url,
params_ins,
function (res_ins) {
// insert done.
console.log('Set Interval: Offer!');
interval_gro = window.setInterval('get_remote_sdp(\'offer\');', interval_time); // listen for an offer of somebody else.
}
);
}
);
peer_con.onicecandidate = function (evt) {
console.log('Step 1');
if ( evt.candidate != null ) {
console.log('Step 2');
console.log(evt.candidate);
var i = 0;
var already_used = false;
while(already_used_can[i] != null){
if(already_used_can[i] == evt.candidate){
already_used = true;
}
i++;
}
// we add outself here:
if(already_used == false){
if(remote_desc_set == true){
already_used_can[already_used_can.length] = evt.candidate;
peer_con.addIceCandidate( new RTCIceCandidate( evt.candidate ) );
// and here we give our candidate to the database.
var this_sdp_json = JSON.stringify(evt.candidate);
var params_candidate = "mode=insert_candidate&sdp_con=" + this_sdp_json + "&pass=" + pwd + "&service_url=" + service_url;
ajax_request_simple(signaling_url, params_candidate, function (evt){
console.log("Saved candidate to db!");
console.log(evt);
});
if(interval_grc != null){
// window.clearInterval(interval_grc);
interval_grc = null;
console.log('Cleared Interval (candidate) => We found something!');
}
}
} else {
console.log('We already used that one!');
}
}
};
peer_con.ontrack = function (evt) {
console.log('Step 3');
video_el_partner.srcObject = evt.stream;
clear_the_intervals();
};
peer_con.oniceconnectionstatechange = function (evt) {
console.log("PeerCon-State: ");
console.log(peer_con.iceConnectionState);
if(peer_con.iceConnectionState == 'failed'){
clear_the_intervals();
}
}
}
).catch(
function (error) {
console.log('Problem: ');
console.log(error);
}
);
} else {
console.log("navgiator or navigator.mediaDevices is not defined.");
}
}
} else {
console.log('init_stream(): We can only do anything like that on https-connections! Http is not supported by the browser!');
}
}
window.onload = function () {
document.getElementById('button_start_stream').onclick = function () {
init_stream('video_partner', 'video_local', true, false);
}
}
function clear_the_intervals() {
if(interval_grc != null){
window.clearInterval(interval_grc);
}
if(interval_gra != null){
window.clearInterval(interval_gra);
}
if(interval_gro != null){
window.clearInterval(interval_gro);
}
}
function is_json_str(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
function get_remote_sdp(type) {
console.log("Current Signaling State: " + peer_con.signalingState);
console.log("Current Iceconnection State: " + peer_con.iceConnectionState);
if(type != 'offer' && type != 'answer' && type != 'candidate'){
type = 'offer';
}
var params_read = "mode=get_" + type + "&pass=" + pwd + "&service_url=" + service_url;
ajax_request_simple (
signaling_url,
params_read,
function (res_read) {
// done.
if(is_json_str(res_read)){
// seems like we get one now.
// lets use that to connect and stream the video to the remote view.
var sdp_data = res_read;
sdp_data = JSON.parse(sdp_data);
// clear interval if found.
console.log('We got a/an ' + type + '!');
if(type == 'offer'){
peer_con.setRemoteDescription(
new RTCSessionDescription(sdp_data), function(){
remote_desc_set = true;
// clear offer interval.
if(interval_gro != null){
window.clearInterval(interval_gro);
interval_gro = null;
console.log('Cleared Interval (' + type + ') => We found something!');
}
peer_con.createAnswer(
function (answer) {
peer_con.setLocalDescription(answer);
var this_sdp_json = JSON.stringify(answer);
var params_answer = "mode=insert_answer&sdp_con=" + this_sdp_json + "&pass=" + pwd + "&service_url=" + service_url;
ajax_request_simple(signaling_url, params_answer, function (){
// answer worked... now lets see about candidates!
interval_grc = window.setInterval('get_remote_sdp(\'candidate\');', interval_time);
});
}, function (err) {
console.log('Error: ' + err);
}
);
},
function(e) {
console.log("Problem while doing client-answer: ", e);
}
);
}
if(type == 'candidate'){
if(typeof sdp_data == 'object' && typeof sdp_data.candidate != 'undefined'){
console.log("We found a candidate... lets add it!");
console.log(sdp_data);
// add candidates from partner source.
// we could try that here or we just use onicecandidate for it.
peer_con.addIceCandidate( new RTCIceCandidate(sdp_data),
function () {
console.log('IceCandidate added: ');
console.log(sdp_data);
console.log("Current Iceconnection State while added Can: " + peer_con.iceConnectionState);
// clear offer interval.
if(interval_grc != null){
window.clearInterval(interval_grc);
interval_grc = null;
console.log('Cleared Interval (' + type + ') => We found something!');
}
},
function (error) {
console.log('Could not add candidate from remote: ');
console.log(error);
}
);
} else {
console.log('Candidate seems not to be a candidate!');
console.log(sdp_data);
}
}
} else {
console.log("Can not parse: ");
console.log(res_read);
}
}
);
}
function ajax_request_simple(url, params, callback, callbackReadyState, callbackError) {
//erstellen des requests
var req = null;
try{
req = new XMLHttpRequest();
} catch (ms){
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (nonms){
try{
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed){
req = null;
}
}
}
if (req == null) {
alert("Error creating request object!");
}
// request created
// request is asynchron
url = decodeURIComponent(url.replace(/\+/g, ' '));
req.open("POST", url, true);
// when request has finished, do this:
req.onreadystatechange = function(){
if(callbackReadyState != null)
callbackReadyState(req);
switch(req.readyState) {
case 4:
if(req.status != 200) {
if(callbackError != null)
callbackError(req);
} else {
if(req != null && req.responseText != null){
if(callback != null)
{
callback(req.responseText);
}
return req.responseText;
}
}
break;
default:
return false;
break;
}
};
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send(params);
}
/* ``` */
<html>
<head>
<title>WebRTC</title>
<script type="text/javascript" src="js.js"></script>
<script type="text/javascript" src="script/js_ajax_request_simple.js"></script>
<style>
video {
border: 1px solid rgba(0, 0, 0, 1.0);
}
</style>
</head>
<body>
<a id="button_start_stream" href="#" style="clear: both; margin-bottom: 1em; width: 100%; text-align: center; background-color: rgba(50, 200, 255, 1.0); padding: 0.5em;">Starte Stream!</a>
<div class="clear"> </div>
<div style="width: 40%; float: left;">
Your video (local): <br />
<video id="video_local" width="512" height="384" autoplay />
</div>
<div style="width: 40%; float: right;">
Partner video (external): <br />
<video id="video_partner" width="512" height="384" autoplay />
</div>
</body>
</html>
But now I ran into another problem with the candidates: "OperationError: Unknown ufrag (71c0b048)" (seems to not know the user fragment)
...and after a small while: "ICE failed, add a TURN server and see about:webrtc for more details". (I already added a STUN server... (before he told me do add a STUN server)
Do you have any idea what is going on there? I searched for it on the internet but all I can find are fixed errors in the Firefox or Chrome bug tracking systems.
At the server side there is a mysql database which will put the different json objects into the database and return it with the different modes like "get_offer", "get_answer" and "get_candidate". (that seems to be working. It saves the different objects like it should and seems to be able to return it fine too.
I am not totally sure if this has to do with my code or if it is something about my internet connection...
When I go to about:webrtc I get this at the session statistics:
Local SDP (Answer)
v=0
o=mozilla...THIS_IS_SDPARTA-76.0 6691071015214921257 1 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 09:C5:79:51:A7:61:00:44:14:7F:5F:3F:16:B3:8C:6E:3D:9E:C9:0C:83:66:57:72:69:25:94:B8:58:CB:F5:EC
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 65055 UDP/TLS/RTP/SAVPF 120 121 126 97
c=IN IP4 84.103.204.172
a=candidate:0 1 UDP 2122252543 2003:e8:4731:e00:9a0:72b1:6ccb:2352 65053 typ host
a=candidate:3 1 UDP 2122187007 2003:f4:4721:e01:f1da:ab8c:e8f3:5413 65054 typ host
a=candidate:6 1 UDP 2122121471 192.168.178.67 65055 typ host
a=candidate:9 1 TCP 2105524479 2003:e8:4731:e00:9a0:72b1:6ccb:2352 9 typ host tcptype active
a=candidate:10 1 TCP 2105458943 2003:f4:4721:e01:f1da:ab8c:e8f3:5413 9 typ host tcptype active
a=candidate:11 1 TCP 2105393407 192.168.178.67 9 typ host tcptype active
a=candidate:7 1 UDP 1685921791 84.109.214.122 65055 typ srflx raddr 192.168.178.67 rport 65055
a=sendrecv
a=end-of-candidates
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http;//www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:121 max-fs=12288;max-fr=60
a=ice-pwd:6327ee3c3108793e412c2b050f48f0b6
a=ice-ufrag:286eca5e
a=mid:0
a=msid:{dbd45d86-df25-4a42-c737-89d745cdf212} {cf6231c0-c924-7b22-bd8d-b2652f46f26e}
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=rtpmap:126 H264/90000
a=rtpmap:97 H264/90000
a=setup:active
a=ssrc:1791964255 cname:{d0f6f8de-ec46-738f-1bbd-b17abbc4831}
External SDP (Offer)
v=0
o=mozilla...THIS_IS_SDPARTA-76.0 2334691361019050498 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 DB:28:1E:DB:ED:3A:B2:01:31:DA:7D:01:8C:F9:98:49:66:4C:B3:F5:7F:A8:1D:F9:09:33:CE:D6:FC:63:7E:76
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 9 UDP/TLS/RTP/SAVPF 120 121 126 97
c=IN IP4 0.0.0.0
a=sendrecv
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http;//www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=extmap:6/recvonly http;//www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:121 max-fs=12288;max-fr=60
a=ice-pwd:3391de6dc44272a622cb482b55b08f2
a=ice-ufrag:71c0b048
a=mid:0
a=msid:{72632409-82d5-4925-af57-8d2fc77fb5c2} {1653a39b-5de5-4055-8632-dbf58fdcf37d}
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=rtpmap:126 H264/90000
a=rtpmap:97 H264/90000
a=setup:actpass
a=ssrc:900017133 cname:{528ff569-d0ca-42f8-d665-341cd42e2b1c}
And this is the the connection log (shortend... it would be several hundred lines):
(registry/INFO) insert 'ice' (registry) succeeded: ice
(registry/INFO) insert 'ice.pref' (registry) succeeded: ice.pref
(registry/INFO) insert 'ice.pref.type' (registry) succeeded: ice.pref.type
(registry/INFO) insert 'ice.pref.type.srv_rflx' (UCHAR) succeeded: 0x64
(registry/INFO) insert 'ice.pref.type.peer_rflx' (UCHAR) succeeded: 0x6e
(registry/INFO) insert 'ice.pref.type.host' (UCHAR) succeeded: 0x7e
(registry/INFO) insert 'ice.pref.type.relayed' (UCHAR) succeeded: 0x05
(registry/INFO) insert 'ice.pref.type.srv_rflx_tcp' (UCHAR) succeeded: 0x63
(registry/INFO) insert 'ice.pref.type.peer_rflx_tcp' (UCHAR) succeeded: 0x6d
(registry/INFO) insert 'ice.pref.type.host_tcp' (UCHAR) succeeded: 0x7d
(registry/INFO) insert 'ice.pref.type.relayed_tcp' (UCHAR) succeeded: 0x00
(registry/INFO) insert 'stun' (registry) succeeded: stun
(registry/INFO) insert 'stun.client' (registry) succeeded: stun.client
(registry/INFO) insert 'stun.client.maximum_transmits' (UINT4) succeeded: 7
(registry/INFO) insert 'ice.trickle_grace_period' (UINT4) succeeded: 5000
(registry/INFO) insert 'ice.tcp' (registry) succeeded: ice.tcp
(registry/INFO) insert 'ice.tcp.so_sock_count' (INT4) succeeded: 0
(registry/INFO) insert 'ice.tcp.listen_backlog' (INT4) succeeded: 10
(registry/INFO) insert 'ice.tcp.disable' (char) succeeded: \000
(ice/INFO) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)
(ice/INFO) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)
(ice/WARNING) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): failed to create passive TCP host candidate: 3
(ice/INFO) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)
(ice/INFO) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)
(ice/WARNING) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): failed to create passive TCP host candidate: 3
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): failed to resolve candidate srflx(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:59764/UDP|stun.schlund.de:3478).
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/CAND(srflx(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:59764/UDP|stun.schlund.de:3478)): failed to initialize, 11 remaining
...
(stun/INFO) Skipping SOURCE-ADDRESS
(stun/INFO) Skipping CHANGED-ADDRESS
(stun/INFO) STUN-CLIENT(srflx(IP4:192.168.178.67:59766/UDP|stun.schlund.de:3478)): Received response; processing
Received response; processing
(stun/INFO) Skipping SOURCE-ADDRESS
(stun/INFO) Skipping CHANGED-ADDRESS
(stun/INFO) STUN-CLIENT(srflx(IP4:192.168.178.67:59766/UDP|iphone-stun.strato-iphone.de:3478)): Received response; processing
(ice/INFO) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): All candidates initialized
...
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) has no stream matching stream PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_0 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea
(ice/INFO) /builds/worker/checkouts/gecko/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)
...
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) has no stream matching stream PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea
(ice/NOTICE) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) no streams with non-empty check lists
(ice/NOTICE) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) no streams with pre-answer requests
(ice/NOTICE) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) no checks to start
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) pairing local trickle ICE candidate host(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:64034/UDP)
...
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): failed to resolve candidate srflx(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:64034/UDP|iphone-stun.strato-iphone.de:3478).
(ice/WARNING) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/CAND(srflx(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:64034/UDP|iphone-stun.strato-iphone.de:3478)): failed to initialize, 5 remaining
...
(stun/INFO) Skipping SOURCE-ADDRESS
(stun/INFO) Skipping CHANGED-ADDRESS
(stun/INFO) STUN-CLIENT(srflx(IP4:192.168.178.67:64036/UDP|stun.schlund.de:3478)): Received response; processing
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) pairing local trickle ICE candidate srflx(IP4:192.168.178.67:64036/UDP|stun.schlund.de:3478)
...
(ice/INFO) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/)): peer (PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default) Trickle grace period is over; marking every component with only failed pairs as failed.
(ice/INFO) ICE-PEER(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/):default)/STREAM(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/STREAM(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea): state dump
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/ICE-STREAM(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea): Local component 1 - dumping candidates
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/ICE-STREAM(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea)/CAND(jH9H): host(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:64034/UDP)
(ice/ERR) ICE(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/))/ICE-STREAM(PC:1586800727564000 (id=103079215106 url=https;//xyz.de/webrtc/) transport-id=transport_1 - 53c0f0cf:c226a179c3d3eefd94c1da8368e16fea)/CAND(r11H): srflx(IP6:[2007:f3:4235:f00:910:75c1:6deb:2421]:64034/UDP|stun.schlund.de:3478)
...
I changed a couple of IPs and hashes for this post, but hopefully not in a way that it is no longer readable.
Does anybody have an idea what is going on?
Best regards and thank you very much for any tip you can share. Fuchur
回答1:
"uFrag" is short for "usernameFragment", which is a property of the ICE candidate. From the w3 specification:
If candidate.usernameFragment is not null, and is not equal to any username fragment present in the corresponding media description of an applied remote description, reject p with a newly created OperationError and abort these steps.
I haven't done this myself but if you're looking for a quick and dirty solution, from the spec it seems like you could just set the uFrag to null
like so:
evt.candidate.usernameFragment = null;
peer_con.addIceCandidate( new RTCIceCandidate( evt.candidate ) );
回答2:
I had the same error message.
My mistake was that I tried to add the ICE candidates from the remote user to the wrong peer connection (i.e., I called pc.addIceCandidate(theIceCandidate)
on the wrong peer connection pc
).
来源:https://stackoverflow.com/questions/61292934/webrtc-operationerror-unknown-ufrag