DEV Community

Vitor Norton for SuperViz

Posted on

How to remove Presence3D when leaving a Video Conference

Hey there, today I want to share with you a quick tip on how to remove Presence3D when leaving a Video Conference, especially if you are migrating from version 4.

On v5, the components (such as Presence3D and Video Conference) are initialized separately, so you need to make sure you are removing both of them.

This is different from v4, where the components were initialized together and the participant would be removed from the 3D automatically once leaving the meeting.

The best way to remove the participant from the 3D model is to listen to an event from Video Conference for when the participant leaves, and for that you can use the MY_PARTICIPANT_LEFT event.

This will trigger once the current participant clicks on the “Leave” button, and then we can remove the Presence3D.

Here is what the code should look like:

video.subscribe("my-participant.left", onMyParticipantLeft);

function onMyParticipantLeft(participant) {
    room.removeComponent(presence);
}
Enter fullscreen mode Exit fullscreen mode

We hope this helps you to create amazing video experiences with SuperViz. If you are migrating from v4, please check out our migration guide for more details. If you have any questions or feedback, please join us at our Discord server.

Top comments (0)