Detect when a user leaves meeting?

Description

I want to detect when the user in the current client leaves the meeting by clicking on the red button. I’ve tried these two handlers, but onUserLeave never fires and onMeetingStatus fires only on initing, not closing:

 ZoomMtg.inMeetingServiceListener('onUserLeave', function (data) {
    console.log(data);
  });

   ZoomMtg.inMeetingServiceListener('onMeetingStatus', function (data) {
    // {status: 1(connecting), 2(connected), 3(disconnected), 4(reconnecting)}
    console.log(data);
  });

Which version?
WebSDK 1.90

Device (please complete the following information):

  • Device:PC
  • OS: Windows
  • Version:10
  • Browser: Chrome

Hey @bferster,

Thank you for reaching out to the Zoom Developer Forum. Good question! The onUserLeave event will only fire for users that are not the host as when the host ends the meeting, the page redirects before it has a chance to fire.

The same is true when it comes to onMeetingStatus. For participants of the meeting, you’ll see this event fire. However, the host won’t see this event fire before the page redirects at the end of the meeting.

You can use these methods to detect when a user leaves it just may not work for the host. When it comes to the host, you may want to look into the meeting.started or meeting.participant_joined webhooks.

Let me know if that helps.

Thanks,
Max

@MaxM

Have you fixed InMeetingListeners event according to what i reported here ?

If not, can you please re open this topic and provide an update ?

I guess that makes sense. I solved the issue for now by handling a click on the Leave button, but that’s somewhat of a kluge

Hey @bferster,

For the time being, that’s a good solution. You can also create an event listener for the beforeUnload and the unload events.

That should make sure that when the page is redirected or tab/browser is closed for the host, you can perform any actions that you need.

Thanks,
Max

Hey @nvivot,

I’ve re-opened and updated that topic.

Thanks,
Max

Thanks. I’m already doing that, When the user clicks the button, I send a cross-domain message to the caller to close the window.

Hey @bferster,

I’m glad to hear you found a solution that works for you! If you would like this feature to be considered for a future release, I recommend posting in the #feature-requests category.

Thanks,
Max