Reputation: 20019
I'm running WebRTC demo in my chrome browser and I can already set up a video conference. However, if one of the peers disconnects (refreshes the browser for instance), I have no idea how to detect it on the other side (and maybe alert a "Peer disconnected" message)
I've noticed that after the peer is disconnected, I receive some ice candidates
, but I can't find any attribute which would help me to discover that this is actually a disconnected event.
I have googled and found this
This would be handled via the "disconnected" state for RTCIceConnectionState. It will trigger after some TBD (currently ~5s) delay of not receiving liveness checks or media from the remote side
But I just can't find this "disconnected" state in my other's peer object.
Can you give me some more hints on this one? Thanks
Upvotes: 2
Views: 6898
Reputation: 4870
You need to check this read-only attribute:
peerconnection.iceConnectionState === 'disconnected'
References:
Upvotes: 3