我正在尝试实施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}
我已经通过以下链接: -
答案 0 :(得分:2)
我能够使用以下帖子解决它:
WebRTC DataChannel: working in Firefox but not Chrome
我不得不改变
pc = new RTCPeerConnection(configuration,
{optional: [{RtpDataChannels: true}]});
到
pc = new RTCPeerConnection(configuration);