Handling calls across browser tabs/windows

Hi. We have a browser based daily video calling app. Everything works great until the user opens a second tab/window. They can be in a call in one tab, and another in a second tab. They might even join their call, forget they have a tab open, feedback loop, etc.

Any advice how to handle multi tab/window and video calls? We're currently limiting functionality across tabs/windows using the BroadcastChannel API. It works somewhat.. interested if anyone has any tried/tested solution?


Answers

  • Hello!

    One approach we suggest when attempting to restrict or prevent users from joining a session multiple times is using meeting tokens that have user_ids included (for uniquely identifying each user) and checking the list of participants to detect duplicate joins. The list of participants can be retrieved via the participants() method or by listening to the participant events.

    If you're using rooms configured as private, you can also configure meeting tokens with short expiration times via the exp parameter, to prevent using the same token to join a session multiple times. Keep in mind that if a user disconnects and the token has expired, a new token will be needed to rejoin.

    If a duplicate join is detected (i.e. a user joins and finds an existing participant with the same user_id already in the session) the most recent participant can call leave(), or otherwise indicate in the UI that they are already in the session.

    You can also reference the /presence REST API endpoint to view user info across an entire domain, though at the moment we don't have a server-side method to remove a single participant from a session just yet (it's on our to-do list!)

    If you have feedback on ways we can improve the API to better solve the issue of detecting and preventing duplicate joins, please let us know!