Skip to main content
Version: 0.1.x

Participant Events - React Native

VideoSDK provides multiple types of events which can be listened to know the about the participants in the meeting.

Here are the events specifically related to the participant:

onParticipantJoined()

  • This event is triggered when someone joins the meeting, returning the Participant object as parameter.
  • It can be subscribed to using the useMeeting hook.

onParticipantLeft()

  • This event is triggered when someone leaves the meeting.
  • It can be subscribed to using the useMeeting hook.

onWebcamRequested()

  • This event is triggered for participant B, when another participant, A requests to enable their webcam.
  • Upon accepting the request, participant B's webcam will be enabled.
  • It can be subscribed to using the useMeeting hook.

onMicRequested()

  • This event is triggered for participant B, when another participant, A requests to enable their mic.
  • Upon accepting the request, participant B's mic will be enabled.
  • It can be subscribed to using the useMeeting hook.

Example

Here is an example demonstrating the usage of all the events mentioned on this page.

function onMicRequested(data) {
const { participantId, accept, reject } = data;

// participantId, will be the id of participant who requested to enable mic

// if accept request
accept();

// if reject request
reject();
}

function onWebcamRequested(data) {
const { participantId, accept, reject } = data;

// participantId, will be the id of participant who requested to enable webcam

// if accept request
accept();

// if reject request
reject();
}

function onParticipantJoined(participant) {
console.log(" onParticipantJoined", participant);
}

function onParticipantLeft(participant) {
console.log(" onParticipantLeft", participant);
}

const {
meetingId
...
} = useMeeting({
onParticipantJoined,
onParticipantLeft,
onMicRequested,
onWebcamRequested,
...
});

API Reference

The API references for all the methods and events utilised in this guide are provided below.

Got a Question? Ask us on discord