Participant Events - Flutter
VideoSDK provides various events that can be utilized to gather information about the participants in the meeting.
Here are the events specifically related to the participant:
Events.participantJoined
- This event is triggered when someone joins the meeting, returning the
Participantobject as parameter. - It can be subscribed to using the
Roomobject.
Events.participantLeft
- This event is triggered when someone leaves the meeting, along with the participantId and Reason. You can refer to the reason details here.
- It can be subscribed to using the
Roomobject. - When
Events.participantLeftis triggered, a reason object is also provided. - The table below outlines the possible reason codes and their descriptions:
| Type | Code | Message |
|---|---|---|
| WEBSOCKET_DISCONNECTED | 1001 | Socket disconnected. |
| REMOVE_PEER | 1002 | Participant was removed from the meeting. |
| REMOVE_PEER_VIEWER_MODE_CHANGED | 1003 | Participant removed because viewer mode was changed. |
| REMOVE_PEER_MEDIA_RELAY_STOP | 1004 | Your organization has reached the maximum number of speakers allowed. |
| SWITCH_ROOM | 1005 | Participant switched to a different room. |
| ROOM_CLOSE | 1006 | The meeting has been closed. |
| UNKNOWN | 1007 | Participant disconnected due to an unknown reason. |
| REMOVE_ALL | 1008 | Remove All from the meeting. |
| MEETING_END_API | 1009 | Meeting Ended. |
Events.cameraRequested
- This event is triggered for participant
B, when another participant,Arequests to enable their webcam. - Upon accepting the request, participant
B's webcam will be enabled. - It can be subscribed to using the
Roomobject.
Events.micRequested
- This event is triggered for participant
B, when another participant,Arequests to enable their mic. - Upon accepting the request, participant
B's mic will be enabled. - It can be subscribed to using the
Roomobject.
Example
Here is an example demonstrating the usage of all the events mentioned on this page.
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class MeetingScreen extends StatefulWidget {
//Existing configuration
}
class _MeetingScreenState extends State<MeetingScreen> {
late Room _room;
@override
void initState() {
//Existing configuration
setupRoomEventListener();
}
@override
Widget build(BuildContext context) {
return YourMeetingWidget();
}
void setupRoomEventListener() {
_room.on(Events.participantJoined, (Participant participant) {
// New Participant joined the room
});
_room.on(Events.participantLeft, (String participantId , LeaveReason reason) {
// Participant left the room
});
_room.on(Events.cameraRequested, (data) {
String? participantId = data["participantId"];
Function accept = data["accept"];
Function reject = data["deny"];
// participantId, will be the id of participant who requested to enable camera
// if the request is accepted
accept();
// if the request is rejected
reject();
});
_room.on(Events.micRequested, (data) {
String participantId = data["participantId"];
Function accept = data["accept"];
Function reject = data["reject"];
// participantId, will be the id of participant who requested to enable camera
// if the request is accepted
accept();
// if the request is rejected
reject();
});
}
}
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

