javascript - Ending WebRTC video call between two peers -
i've set video chat between 2 peers using webrtc
. allow peer end chat , other peer know chat ended. 1 time chat ends, code needs executed both peers. peerconnection
object has removestream()
method should trigger onremovestream()
listener. perfect utilize case, however, before onremovestream() called there needs re-negotiation (offer/answer) between peers. case seems odd. why re-negotiate disconnect? shouldn't peerconnection object realize no stream coming other user? my question: how can end peerconnection , alert other user?
you can close connection. other peer can hear signal oniceconnectionstatechange
, state of disconnected
means peer has closed connection/is no longer available. if you, timeout before closing state because of flaky network connection. mdn has info
or, maintain track of connections signalling server , signal peers when leaves. either way should work.
javascript google-chrome firefox webrtc p2p
No comments:
Post a Comment