Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaConnection close event #87

Closed
khashayar opened this issue Oct 17, 2013 · 9 comments
Closed

MediaConnection close event #87

khashayar opened this issue Oct 17, 2013 · 9 comments
Assignees
Labels
bug platform-specific issues affecting only specific platforms

Comments

@khashayar
Copy link

Once I close the Media connection on a peer, the remote peer doesn't receive the "close" event. as the docs says for this event:
"Emitted when either you or the remote peer closes the media connection."

Although once I call the MediaConnection.close() on a peer, the remote peer (Only on Chrome) gets the event "oniceconnectionstatechange" after a few secs and then peer.js' callback calls the connection.close() explicitly, but for remote peers on Firefox nothing happens.

@ghost ghost assigned ericz Oct 18, 2013
@ericz
Copy link
Member

ericz commented Oct 19, 2013

Unfortunately AFAIK there is no way to detect the connection close on Firefox yet.

As you mentioned, oniceconnectionstatechange does not yet work on FF. Neither does the deprecated functions that I tested. I also tested the onended event on media stream, it also does not fire on FF.

Here is the relevant bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=852665

The only other solution would be for PeerJS to send a "leave" message of some sort through PeerServer but that would not work reliably with the user closing the tab etc.

@ericz
Copy link
Member

ericz commented Oct 19, 2013

And we don't want to use disconnecting from PeerServer as an indication of leaving because established connections should continue to work even if disconnect from PeerServer

@michelle
Copy link
Member

Can't fix for now.

@fraserxu
Copy link

I got the similar issue while trying to listen on the close event.

By calling the peer.destroy() method, I could only get the

"PeerJS: iceConnectionState is disconnected..." message. But the peer.on('close', cb) event which listend on the other end of the server can't be fired.

peer.on('close', function() {
    console.log('on close')
})

I'm not sure if is that a good idea to add this to the peer.on('close', cb) event or something else like peer.on('destroy', cb) so that the other end could get the message and do something instead of losing the video stream without knowing what happend.

@cprakash-comtech
Copy link

I think this issue is still present in firefox, Is anyone fixing this?

@RamyaAshika
Copy link

Any updates?

@bennlich
Copy link
Contributor

bennlich commented Aug 1, 2020

Looks like firefox should support the underlying event now: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState#Browser_compatibility

@ericwooley
Copy link

ericwooley commented Aug 31, 2020

This seems to still be an issue, and it's very annoying to deal with. Instead of closing the media connection, I am now having to resort to sending a websocket message that the peer is closing the audio connection.

@jbdemonte
Copy link

jbdemonte commented Jan 18, 2023

Still there I guess,
when a user just close its browser, its remote peers are not getting any event to close the media and clean their stuff

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-specific issues affecting only specific platforms
Projects
None yet
Development

No branches or pull requests

9 participants