//CreatethelocalconnectionanditseventlistenerslocalConnection=newRTCPeerConnection();//CreatethedatachannelandestablishitseventlistenerssendChannel=localConnection.createDataChannel("sendChannel");sendChannel.onopen=handleSendChannelStatusChange;sendChannel.onclose=handleSendChannelStatusChange;localConnection.ondatachannel=receiveChannelCallback;sendChannel.onmessage=handleReceiveMessage;//函數(shù)明細(xì)省略sendChannel.send('aaaa');//發(fā)送成功sendChannel.send(newArrayBuffer(111));//成功sendChannel.send(newArrayBuffer(872494));//發(fā)送之后sendChannel通道自動(dòng)關(guān)閉了,數(shù)據(jù)也沒(méi)發(fā)送成功,sendChannel.bufferedAmount//872494//發(fā)送文件varread=newFileReader()read.readAsArrayBuffer(file)//file=inputfileread.onloadend=()=>{sendChannel.send(read.result)console.log(sendChannel)//狀態(tài)為closedconsole.log(read.result)//arraybuffer}不知道是不是有什么限制,在發(fā)送input中輸入的文本沒(méi)有問(wèn)題,當(dāng)我想發(fā)送image文件時(shí)就掛掉了.還請(qǐng)大佬能指點(diǎn)一下。
有沒(méi)有人遇到過(guò)這個(gè)問(wèn)題哈!WebRTC dataChannel.send這個(gè)發(fā)送的數(shù)據(jù)有長(zhǎng)度限制嗎
尚方寶劍之說(shuō)
2019-11-03 09:34:36