Gen*_*Man 5 javascript web webrtc simplewebrtc
我正在努力学习WebRTC.我复制了一些代码,我收到此错误:
无法在'RTCDataChannel'上执行'send':RTCDataChannel.readyState不是'open'
任何人都可以帮忙吗?
代码分数:http://www.tutorialspoint.com/webrtc/webrtc_text_demo.htm
小智 10
ondatachannel删除后添加处理{optional: [{RtpDataChannels: true}]}:
myConnection.onicecandidate = function (event) {
if (event.candidate) {
send({
type: "candidate",
candidate: event.candidate
});
}
};
myConnection.ondatachannel = function(event) {
var receiveChannel = event.channel;
receiveChannel.onmessage = function(event) {
console.log("ondatachannel message:", event.data);
};
};
openDataChannel();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1876 次 |
| 最近记录: |