Video SDK Web and Version
Zoom Web Video SDK 1.11.6
Google Chrome
Hello.
I am currently using the Video SDK in a web browser.
One of the requirements we are currently trying to achieve is to realize an exclusivity control where if there are multiple joins to a session with the same account (userIdentifer is given via server), the participant who was originally there will leave the session.
Currently, we assume that the last participant obtained by getAllUser() is the newest participant.
Is there any other way to get a guaranteed join order?
In the Video SDK, we provide the user-added event, which is triggered when a new user joins the session. The event payload contains the new user’s information, allowing you to determine if it is a duplicate user.
client.on("user-added", (payload) => {
const allUsers = client.getAllUser();
payload.forEach((user) => {
const { userIdentity, userId } = user;
if (userIdentity) {
const duplicatedUsers = allUsers.filter(
(item) => item.userIdentity === userIdentity
);
// If there are more than one users, it indicates the presence of duplicate users.
if (duplicatedUsers.length > 1) {
const originalUser = duplicatedUsers.filter(
(item) => item.userId !== userId
);
// Todo: let the original user leave the session
}
}
});
});