Я пытаюсь установить sh канал данных WebRT C между моим телефоном и браузером. 50% времени это работало. 50% времени это не будет работать. Сообщение об ошибке будет иметь следующий вид:
DOMException:
Failed to execute 'setRemoteDescription' on 'RTCPeerConnection':
Failed to set remote offer sdp:
Failed to apply the description for 0:
Failed to setup RTCP mux.
Что это значит?
Ошибка возникла здесь:
...
if (m.type == 'offer') {
//console.log('offering');
pc[d.sender].setRemoteDescription(m) // <----
.then(() => pc[d.sender].createAnswer())
.then((answer) => {
pc[d.sender].setLocalDescription(answer);
let child = fdb.ref(d.sender).push();
child.set({ sender: id, data: JSON.stringify(answer) });
child.remove();
})
.catch((error) => {
//console.log(m);
});
...
console.log (pc [d.sender]) ):
RTCPeerConnection {channel: RTCDataChannel, ts: 1585554833887, localDescription: null, currentLocalDescription: null, pendingLocalDescription: null, …}
localDescription: null
currentLocalDescription: null
pendingLocalDescription: null
remoteDescription: RTCSessionDescription {type: "offer", sdp: "v=0
↵o=- 7723203266857331351 2 IN IP4 127.0.0.1
↵s…:0
↵a=sctp-port:5000
↵a=max-message-size:262144
↵"}
currentRemoteDescription: null
pendingRemoteDescription: RTCSessionDescription {type: "offer", sdp: "v=0
↵o=- 7723203266857331351 2 IN IP4 127.0.0.1
↵s…:0
↵a=sctp-port:5000
↵a=max-message-size:262144
↵"}
signalingState: "closed"
iceGatheringState: "complete"
iceConnectionState: "closed"
connectionState: "closed"
onnegotiationneeded: null
onicecandidate: (event) => {…}
onsignalingstatechange: null
oniceconnectionstatechange: null
onconnectionstatechange: null
onicegatheringstatechange: null
onicecandidateerror: null
ontrack: null
ondatachannel: null
onaddstream: null
onremovestream: null
sctp: RTCSctpTransport {transport: RTCDtlsTransport, state: "closed", maxMessageSize: Infinity, maxChannels: null, onstatechange: null}
ts: 1585554833887
__proto__: RTCPeerConnection
console.log (м):
{type: "offer", sdp: "v=0
↵o=- 4983700994120549297 2 IN IP4 127.0.0.1
↵s…:0
↵a=sctp-port:5000
↵a=max-message-size:262144
↵"}type: "offer"sdp: "v=0
↵o=- 4983700994120549297 2 IN IP4 127.0.0.1
↵s=-
↵t=0 0
↵a=group:BUNDLE 0
↵a=msid-semantic: WMS
↵m=application 9 UDP/DTLS/SCTP webrtc-datachannel
↵c=IN IP4 0.0.0.0
↵a=ice-ufrag:7xbk
↵a=ice-pwd:ZxcXMHoZupHbA0SSqZ8YMFSm
↵a=ice-options:trickle
↵a=fingerprint:sha-256 32:0F:EA:DE:E4:13:E8:5E:42:8C:D5:E8:5B:15:B2:98:C9:91:7C:E7:C8:0E:26:8E:54:5E:EE:C5:20:BE:6C:B5
↵a=setup:actpass
↵a=mid:0
↵a=sctp-port:5000
↵a=max-message-size:262144
↵"__proto__: Object
где:
var servers = {
'iceServers': [{
'urls': 'stun:stun.services.mozilla.com'
}, {
'urls': 'stun:stun.l.google.com:19302'
}, {
'urls': 'turn:numb.viagenie.ca',
'credential': 'xxx',
'username': 'xxx@gmail.com'
}]
};
pc[d.sender] = new RTCPeerConnection(servers);