You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, it's a bug, but luckily I can fix it. By just 3 steps.
remove this code "var dataChannel = pc.createDataChannel("text");"
At pc.oniceconnectionstatechange remove this "createDataChannel();"
Change pc.onnegotiationneeded to this one
pc.onnegotiationneeded = function () {
console.log('onnegotiationneeded');
if (isOffer) {
createOffer();
dataChannel = pc.createDataChannel('chat');
createDataChannel();
} else {
// If user is not the offerer let wait for a data channel
pc.ondatachannel = event => {
dataChannel = event.channel;
createDataChannel();
}
}
}
Enjoy. 👍
function textRoomPress() {
var text = document.getElementById('textRoomInput').value;
if (text == "") {
alert('Enter something');
} else {
document.getElementById('textRoomInput').value = '';
var content = document.getElementById('textRoomContent');
content.innerHTML = content.innerHTML + '
' + 'Me' + ': ' + text + '
';for (var key in pcPeers) {
var pc = pcPeers[key];
pc.textDataChannel.send(text);
}
}
}
it is not activating this function:
nothing happens
The text was updated successfully, but these errors were encountered: