Zoom Web SDK onUserLeave not Firing

Description
I’m trying to log when the user leaves the meeting or the host ends the meeting for all the participants.

Error
The ZoomMtg.inMeetingServiceListener('onUserLeave' function doesn’t fire after the user leaves the the meeting.

Which Web Client SDK version?
1.9.0

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Create a meeting
  2. Join the meeting as the Host
  3. Leave the meeting

Device (please complete the following information):

  • Browser: Chrome
  • Browser Version 89.0.4389.128 (Official Build) (64-bit)

Additional context

These are the logs

inMeetingServiceListener onMeetingStatus {meetingStatus: 1}
inMeetingServiceListener onMeetingStatus {meetingStatus: 1}
inMeetingServiceListener onMeetingStatus {meetingStatus: 2}
inMeetingServiceListener onUserJoin {userId: <userid>, userName: <username>, muted: false, audio: null, isHost: true, …}
// Success of init
join meeting success {method: "join", status: true, errorCode: 0, errorMessage: null, result: null}

After leaving the meeting there is no log for onMeetingStatus or onUserLeave

Hey @thefantastic4it,

Thank you for reaching out to the Zoom Developer Forum. First, I’ll note that the onUserLeave event will only fire for users that are still in the meeting. It doesn’t fire for the user that is leaving, prior to them leaving.

Further, the host will not receive the OnMeetingStatus event when the meeting ends as the page redirects before the event is fired. Only participants will receive that event with a status of 3 when the meeting ends.

If that doesn’t help, are you able to provide a code snippet that shows how and where you’re calling the inMeetingServiceListener? If you haven’t already, you can use our Sample Web App as a reference.

Let me know if that helps.

Thanks,
Max

Hi @MaxM,

I was looking at this example sample web.

I don’t quite get the onUserLeave event will only fire for users that are still in the meeting, but when will it be fired? because the name suggest onUserLeave… so it should be fired when the user is not in the meeting anymore right?. If I got it wrong, what is the purpose of this event?

I’m trying to close the window when the user ends the meeting (the redirection is no good for us). Doesn’t matter if the user is a participant or the host, if the user leaves the meeting (pressing the leave button) our requirement is to close the window.

Thanks,
William

Hey @thefantastic4it,

Happy to help clarify—to that end, the onUserLeave event will fire as expected for users that are not the host (regular participants) as when the host ends the meeting, the page redirects before it has a chance to fire for the host.

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 this helps to clarify,
Will

Hi @will.zoom,

I’ve been testing the onUserLeave for the users that are not the host. Can you confirm that the onUserLeave it only fires for other participants that remains on the meeting, and the user that leaves just only redirects to the leave url and does not fire an event.

What I really want to know is if there is any event that is trigger after the user leaves the meeting. What I seen so far is that using my logs is that the events are only fired while you are on the call, after you leave you can only expect the redirect url.

Thanks,
William

Hey @thefantastic4it,

Thank you for your questions, I’m glad that Will was able to clarify my point!

Yes, that is correct.

You can use the meeting.participant_left webhook if you want an event that fires when a participant leaves a meeting.

Thanks,
Max

1 Like