//CreatethelocalconnectionanditseventlistenerslocalConnection=newRTCPeerConnection();//CreatethedatachannelandestablishitseventlistenerssendChannel=localConnection.createDataChannel("sendChannel");sendChannel.onopen=handleSendChannelStatusChange;sendChannel.onclose=handleSendChannelStatusChange;localConnection.ondatachannel=receiveChannelCallback;sendChannel.onmessage=handleReceiveMessage;//函數(shù)明細省略sendChannel.send('aaaa');//發(fā)送成功sendChannel.send(newArrayBuffer(111));//成功sendChannel.send(newArrayBuffer(872494));//發(fā)送之后sendChannel通道自動關閉了,數(shù)據(jù)也沒發(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中輸入的文本沒有問題,當我想發(fā)送image文件時就掛掉了.還請大佬能指點一下。
有沒有人遇到過這個問題哈!WebRTC dataChannel.send這個發(fā)送的數(shù)據(jù)有長度限制嗎
尚方寶劍之說
2019-11-03 09:34:36