Meeting Connection Events - React
VideoSDK offers the onMeetingStateChanged()
event, providing information about the current connection state of the meeting.
onMeetingStateChanged()​
- This event is triggered when the state of a meeting changes.
- The event callback will include the current state of the meeting, which can be one of the following:
CONNECTING
,CONNECTED
,RECONNECTING
,DISCONNECTED
. - It can be subscribed to using the
useMeeting
hook.
Example​
Here is an example demonstrating the usage of the event mentioned on this page.
function onMeetingStateChanged(data) {
const { state } = data;
switch(state){
case 'CONNECTING':
console.log("Meeting is Connecting");
break;
case 'CONNECTED':
console.log("Meeting is Connected");
break;
case 'DISCONNECTED':
console.log("Meeting connection disconnected abruptly");
break;
case 'RECONNECTING':
console.log("Meeting is Reconnecting");
break;
default:
console.log("Unknown state:", state);
break;
}
}
const {
meetingId
...
} = useMeeting({
onMeetingStateChanged,
...
});
API Reference​
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord