livekit / components-js

Official open source React components and examples for building with LiveKit.
https://livekit.io
Apache License 2.0
149 stars 67 forks source link

If you close the web page directly, it will take a while for the remote subscriber to receive the leave message, and the screen will not move and stay (> 5-10s) In mobile browsers #799

Closed klk2x closed 6 months ago

klk2x commented 6 months ago

Select which package(s) are affected

\@livekit/components-core, \@livekit/components-react

Describe the bug

The subscriber opens it on the PC segment, and the publisher directly closes the web page or tab after joining the room on the mobile terminal. If directly close the tab to exit instead of clicking hang up, the subscriber's screen will freeze, and it will take >5-10 seconds before the subscriber is considered to have left the meeting.

Reproduction

After entering the room, turn on the camera, connect directly to the web page or tab

Logs

No response

System Info

cross platform

Severity

annoyance

Additional Information

No response

klk2x commented 6 months ago

Room participants all open and close in the PC browser and there is no such problem.

lukasIO commented 6 months ago

Unfortunately there's now way to work around this. It will take a couple of seconds on an abrupt leave of a participant until the server can safely mark it as disconnected.

klk2x commented 6 months ago

This time is currently too long. Can this time be customized? On the subscription side, this picture is still and the feeling is poor.

klk2x commented 6 months ago

@lukasIO

lukasIO commented 6 months ago

you can look at the return value of useConnectionQuality. If a participant transitions to ConnectionQuality.LOST it's an indicator that it might have lost connection. There's no other way to customize it. You can try to hook into specific browser APIs (e.g. pageleave events) and call room.disconnect() manually there. But FWIW that's already what our SDK is doing, too.