Description
We have a Web Video SDK app and are developing a React Native Video SDK app to pair with it.
In the Web app, we have the client.init option leaveOnPageUnload set to true. When a user leaves a web app session by closing or refreshing the page, the user-removed Web SDK event is always sent to the other Web SDK clients in the session.
However, in the React Native app, the equivalent onUserLeave SDK event is inconsistent.
If the Web SDK user who leaves is using a Chromium browser, the onUserLeave event fires.
If the Web SDK user who leaves is using Firefox, the onUserLeave event does NOT fire.
Errors
No errors are shown.
Which React Native Video SDK version?
React Native: 1.13.12
Web: 2.1.10
Smartphone (please complete the following information):
We tested this on Firefox, Safari, Edge, Chrome, Chromium, Brave, and Opera. Of this list, only Firefox has this issue.
We have tried this with Firefox 130.0.1 and 138.0.
Edit: I was incorrect in my original post, the web app’s user-removed event is not firing when Firefox users leave by closing the window. So this must be an issue with the web app’s leaveOnPageUnload and not with the React Native SDK. Is this something you can still assist with or should I open a different thread in the Web SDK category?
leaveOnPageUnload relies on listening to the beforeunload event on the window, and triggers the session leave inside the callback.
However, on Firefox, if the event’s returnValue is not empty or preventDefault() is not called, the callback may be skipped entirely. On the other hand, if returnValue is set, Firefox shows a confirmation popup when the page is closed or refreshed — which is not the intended behavior.
We also tried using the visibilitychange event, but it doesn’t reliably fulfill this functionality either.