RTCDataChannel 就绪状态停留在 chrome 中连接但在 Firefox 中工作

RTCDataChannel ready state stuck at connecting in chrome but working in Firefox

我正在尝试实施 RTCDataChannel(webRTC)。

它在 Firefox 中运行良好,但在 chrome 中运行良好。

Chrome和Firefox都是最新版本。

Chrome 中的 RTCDataChannel 对象:-

RTCDataChannel {
binaryType: "arraybuffer"
bufferedAmount: 0
bufferedAmountLowThreshold: 0
id: 65535
label: "sendDataChannel"
maxRetransmitTime: 65535
maxRetransmits: 65535
negotiated: false
onbufferedamountlow: null
onclose: null
onerror: ƒ (event)
onmessage: ƒ (event)
onopen: ƒ dataChannelStateChanged()
ordered: true
protocol: ""
readyState: "connecting"
reliable: false__proto__:}

Firefox 中的 RTCDataChannel 对象:-

DataChannel { 
binaryType: "blob"
id: 0
label: "sendDataChannel", 
reliable: true, 
readyState: "open",
bufferedAmount: 0, 
bufferedAmountLowThreshold: 0, 
onopen: dataChannelStateChanged(), 
onerror: create_peer_connection/dataChannel.onerror(), 
onclose: null, 
onmessage: create_peer_connection/dataChannel.onmessage(), 
onbufferedamountlow: null 
protocol:""
ordered:true}

我已经浏览过以下链接:-

  1. WebRTC data channel stack on readyState "conecting"
  2. WebRTC dataChannel.readyState stalling on "connecting"
  3. RTCDataChannel's ReadyState is not 'open'.
  4. Webrtc Data Channel always in connecting state and not open

请提出 chrome 中问题背后的原因是什么?

我能够使用以下 post 解决它:

我不得不改变

pc = new RTCPeerConnection(configuration,
                {optional: [{RtpDataChannels: true}]});

pc = new RTCPeerConnection(configuration);