useMeeting Hook Event Callbacks - React Native
onParticipantJoined()
- This event callback is trigger when a new participant joins the meeting.
Example
function onParticipantJoined(participant) {
console.log(" onParticipantJoined", participant);
}
const {
meetingId
...
} = useMeeting({
onParticipantJoined,
...
});
onParticipantLeft()
- This event callback is trigger when a participant leaves the meeting.
Example
function onParticipantLeft(participant) {
console.log(" onParticipantLeft", participant);
}
const {
meetingId
...
} = useMeeting({
onParticipantLeft,
...
});
onSpeakerChanged()
- This event will be emitted when a active speaker changed.
- If you want to know which participant is actively speaking, then this event will be used.
- If no participant is actively speaking, then this event will pass
null
as en event callback parameter.
Example
function onSpeakerChanged(activeSpeakerId) {
console.log(" onSpeakerChanged", activeSpeakerId);
}
const {
meetingId
...
} = useMeeting({
onSpeakerChanged,
...
});
onPresenterChanged()
- This event will be emitted when any participant starts or stops screen sharing.
- It will pass
participantId
as an event callback parameter. - If a participant stops screensharing, then this event will pass
null
as en event callback parameter.
Example
function onPresenterChanged(presenterId) {
console.log(" onPresenterChanged", presenterId);
}
const {
meetingId
...
} = useMeeting({
onPresenterChanged,
...
});
onMainParticipantChanged()
- This event will be emitted when main participant get changed.
- It will pass
participantId
as an event callback parameter.
Example
function onMainParticipantChanged(participantId) {
console.log(" onMainParticipantChanged", participantId);
}
const {
meetingId
...
} = useMeeting({
onMainParticipantChanged,
...
});
onEntryRequested()
- This event will be triggered when a new participant who is trying to join the meeting, is having permission
ask_join
in token. - This event will only be triggered to the participants in the meeting, who is having the permission
allow_join
in token. - This event will pass following parameters as an event parameters,
participantId
andname
of the new participant who is trying to join the meeting,allow()
anddeny()
to take required actions.
Event callback parameters
- data: { allow: Function; deny: Function; name: String; participantId: String }
- allow: Function
- deny: Function
- name: String
- participantId: String
Example
function onEntryRequested(data) {
const { participantId, name, allow, deny } = data;
console.log(`${name} requested to join the meeting.`);
// If you want to allow the entry request
allow();
// if you want to deny the entry request
deny();
}
const {
meetingId
...
} = useMeeting({
onEntryRequested,
...
});
onEntryResponded()
- This event will be triggered when the
join()
request is responded. - This event will be triggered to the participants in the meeting, who is having the permission
allow_join
in token. - This event will be also triggered to the participant who requested to join the meeting.
Event callback parameters
- participantId: String
- decision: "allowed" | "denied"
Example
function onEntryResponded(participantId, decision) {
// participantId will be id of participant who requested to join meeting
if (decision === "allowed") {
// entry allowed
} else {
// entry denied
}
}
const {
meetingId
...
} = useMeeting({
onEntryResponded,
...
});
onRecordingStateChanged()
- This event will be emitted when the meeting's recording status changed.
Example
import { Constants, useMeeting } from "@videosdk.live/react-native-sdk";
function onRecordingStateChanged(data) {
const { status } = data;
if (status === Constants.recordingEvents.RECORDING_STARTING) {
console.log("Meeting recording is starting");
} else if (status === Constants.recordingEvents.RECORDING_STARTED) {
console.log("Meeting recording is started");
} else if (status === Constants.recordingEvents.RECORDING_STOPPING) {
console.log("Meeting recording is stopping");
} else if (status === Constants.recordingEvents.RECORDING_STOPPED) {
console.log("Meeting recording is stopped");
} else {
//
}
}
const {
meetingId
...
} = useMeeting({
onRecordingStateChanged,
...
});
onRecordingStarted()
- This event callback is trigger when meeting recording is started.
Example
function onRecordingStarted() {
console.log("onRecordingStarted");
}
const {
meetingId
...
} = useMeeting({
onRecordingStarted,
...
});
onRecordingStopped()
- This event callback is trigger when meeting recording is stopped.