Comments (2)
The bug still persists, please reopen.
If a participant dies unexpectedly (say, a laptop lid has been closed or the browser window killed), the initiator reports "Peer connection seems has been disconnected between you and <...>" in the logs but onleave() event is not actually raised, I did a fix for that by adding this into oniceconnectionstatechange():
-
// TODO: update the file after fixing
-
// https://github.com/muaz-khan/RTCMultiConnection-experimental/issues/2
-
connection.onleave({
-
userid: _config.userid,
-
extra: _config.extra,
-
entireSessionClosed: connection.isInitiator
-
});
-
from rtcmulticonnection.
iceConnectionState==disconnected
happens too often, even if bandwidth is overused by any other application e.g. skype. Though ICE-Agent quickly makes STUN-binding requests and changes it to connected/stable
again.
iceConnectionState==disconnected
also happens in renegotiation cases.
So, we can't fire connection.leave
in case, when iceConnectionState==disconnected
.
Check this snippet:
connection.ondisconnected = function (event) {
log('Peer connection seems has been disconnected between you and', event.userid);
if (isEmpty(connection.channels)) return;
if (!connection.channels[event.userid]) return;
// use WebRTC data channels to detect user's presence
connection.channels[event.userid].send({
checkingPresence: true
});
// wait 5 seconds, if target peer didn't response, simply disconnect
setTimeout(function () {
// iceConnectionState == 'disconnected' occurred out of low-bandwidth
// or internet connectivity issues
if (connection.peers[event.userid].connected) {
delete connection.peers[event.userid].connected;
return;
}
// to make sure this user's all remote streams are removed.
for (var stream in connection.streams) {
stream = connection.streams[stream];
if (stream.userid == event.userid && stream.type == 'remote') {
connection.onstreamended(stream.streamObject);
}
}
connection.remove(event.userid);
}, 5000);
};
As you can see, I'm checking presence of the target-peer only if WebRTC data connection was used. Previously I was relying on socket.io i.e. signaling medium however I found many cases where socket.io disconnects or keeps disconnected whilst peer connection should work.
You can easily override above ondisconnected
event like this:
connection.onconnected = function (event) {
event.peer.onCustomMessage = function (message) {
if (message.areYouThere) {
event.peer.sendCustomMessage({
yesIAmThere: true
});
}
if (message.yesIAmThere) {
connection.peers[event.userid].connected = true;
}
};
};
connection.ondisconnected = function (event) {
event.peer.sendCustomMessage({
areYouThere: true
});
// wait 5 seconds, if target peer didn't response, simply disconnect
setTimeout(function () {
// iceConnectionState == 'disconnected' occurred out of low-bandwidth
// or internet connectivity issues
if (connection.peers[event.userid].connected) {
delete connection.peers[event.userid].connected;
return;
}
// to make sure this user's all remote streams are removed.
for (var stream in connection.streams) {
stream = connection.streams[stream];
if (stream.userid == event.userid && stream.type == 'remote') {
connection.onstreamended(stream.streamObject);
}
}
connection.remove(event.userid);
}, 5000);
};
from rtcmulticonnection.
Related Issues (20)
- Muaz May Have Left This World! HOT 12
- https://muazkhan.com:9001/ dont work
- Listen to audio stream without microphone HOT 1
- Auto Open behavior of meeting room link possible? HOT 1
- video appearing issue HOT 7
- Problem chromium - chromium HOT 2
- Live Streaming not working in Chrome Beta 110 HOT 5
- how provide public ip and local ip manually to RTCMulticonnection instead using stun and turn server HOT 14
- muazkhan.com:9001 has SSL error
- screen displayed as video HOT 1
- local stream microphone not working while share screen + system audio shared using peerjs webrtc
- please help me to solove this problem, this vue project is alone to use a ip and port(3000), want to inside the screen sharing to this vue project, but the RTCMultiConnection is only to occupy this ip and port(9001),how to handle this issue? HOT 1
- when are on the public internet, two person can't see each other's video HOT 1
- how send rtcmulticonnection screen sharing to rtmp server like youtube HOT 1
- can anyone help me in setting socket server
- can anyone help me in setting socket server
- RTCMulticonnection.min.js is possible running on spring boot?
- Video Conferencing (MANY_TO_MANY) not working anymore HOT 1
- TypeError: (0 , stream_1.pipeline) is not a function
- DIFFERENCE BETWEEN addStream() and captureStream()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtcmulticonnection.