Skip to main content
Version: 0.1.x

Leave or End Meeting - React

Whenever participant wishes to end their communication in the meeting, they can simply leave the meeting.

This guide will provide an overview of how to implement leave or end feature in VideoSDK meetings.

  1. Leave - By using leave() function, only a participant will leave/exit the meeting, the rest of the meeting will continue with other participants.

  2. End - By using end() function, meeting will end for each and every participant. So, use this function according to your use cases.

Leave And End Meeting

import { useMeeting } from "@videosdk.live/react-sdk";

const MeetingView = () => {
const { leave, end } = useMeeting();

const onPress = () => {
// Leave Meeting
leave();

// Exit Meeting
end();
};

return <>...</>;
};

Events

Events associated with leave():

  • Local participant will receive a callback ononMeetingLeft of useMeeting() hook.
  • All remote participants will receive a callback onParticipantLeft with Participant object.

Event associated with end():

  • All remote participants and local participant will receive a callback on onParticipantLeft with Participant object.
function onParticipantLeft(participant) {
console.log(" onParticipantLeft", participant);
}

function onMeetingLeft() {
console.log("onMeetingLeft");
}


const {
meetingId
...
} = useMeeting({
onMeetingLeft,
onParticipantLeft,
...
});

Got a Question? Ask us on discord