Number of Participants present

Hey Zoom team , I have searching for the function which can give me the 'Number of participants ’ present in the zoom video sdk web, but unable to find it in the documentation.

I know there are some events such as user-added, user-removed etc but I specifically want the Participants count in the video call
In twilio we get the participants count but unable to find it on zoom
So can you plz help me with that.

Hey, @krunalrgupta15!

Currently, the Zoom Video SDK supports up to 1,000 participants in a session. To find out how many participants are currently in a session programmatically, the function may differ based on the SDK that you’re currently using; however, for our Web SDK, you can call getAllUser(), which will return an array of all current in-session participants.

Please let me know if you have any further questions!

Thanks,
James

Thanks for replying James,
Yeah I am using that function but it give doesn’t give the “Number of Participants” → numerically

And one more thing the ‘getAllUser()’ giving us the garbage values sometimes like
if user leave and joined continously it can give me the garbage value.
So can you guide me how to deal with it.

@james.coon hey any for suggestions for above question

Hey @krunalrgupta15 ,

You can simply filter out the duplicate users if there were some that left and joined multiple times. For example:

var result = client.getAllUser().reduce((unique, o) => {
    if(!unique.some(obj => obj.label === o.label && obj.value === o.value)) {
      unique.push(o);
    }
    return unique;
},[]);

console.log(result);

Best,
Tommy