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 which specifically relate to the participants.
onParticipantJoined
- This event is triggered when someone joins the meeting and return the
Participant
object as parameter. - This event can be subscribed from the
useMeeting
hook.
onParticipantLeft
- This event is triggered when the someone leaves the meeting.
- This event can be subscribed from the
useMeeting
hook.
onWebcamRequested
- This event will be triggered to the participant
B
when any other participantA
requests to enable webcam of participantB
. - On accepting the request, webcam of participant
B
will be enabled. - This event can be subscribed from the
useMeeting
hook.
onMicRequested
- This event will be triggered to the participant
B
when any other participantA
requests to enable mic of participantB
. - On accepting the request, mic of participant
B
will be enabled. - This event can be subscribed from the
useMeeting
hook.
Example
Here is the usage of all the events mentioned in 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