Room Class Events - Flutter
roomJoined
- This event will be emitted when a localParticipant successfully joined the room.
Example
room.on(Events.roomJoined, (){
// do something
});
roomLeft
- This event will be emitted when a localParticipant left the room.
Example
room.on(Events.roomLeft, () {
// do something
});
participantJoined
- This event will be emitted when a new participant joined the room.
Event handler parameters
- participant: Participant
Example
room.on(Events.participantJoined, (participant) {
// do something
});
participantLeft
- This event will be emitted when a joined participant left the room.
Event handler parameters
- participantId: String
- reason:
Map <String,dynamic>
Participant Left - Reason Codes
| 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 |
Example
room.on(Events.participantLeft, (
String participantId,
Map<String, dynamic> reason,
) {
// do something
});
speakerChanged
- 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
nullas an event handler parameter.
Event handler parameters
- activeSpeakerId: String?
Example
room.on(Events.speakerChanged, (activeSpeakerId) {
// do something
});
presenterChanged
- This event will be emitted when any participant starts or stops screen sharing.
- It will pass
participantIdas an event handler parameter. - If a participant stops screen-sharing, then this event will pass
nullas en event handler parameter.
Event handler parameters
- activePresenterId: String?
Example
room.on(Events.presenterChanged, (activePresenterId) {
// do something
});
pinStateChanged
- This event will be emitted when any participant pin state gets changed.
- It will pass
participantId,state, andpinnedByasMap<String, dynamic>as an event handler parameter.
Event handler parameters
- data:
Map{'<'}String{','} dynamic>{participantId:String, state:Map<String, dynamic>, pinnedBy:String}
Example
room.on(Events.pinStateChanged, (data) {
// do something
});
participantModeChanged
This event is triggered when a participant's mode is updated.
It passes data as an event callback parameter, which includes the following:
-
SEND_AND_RECV: Both audio and video streams will be produced and consumed. -
SIGNALLING_ONLY: Both audio and video streams will not be produced or consumed. It is used solely for signaling. -
RECV_ONLY: Both audio and video streams will be consumed without producing any.
Event handler parameters
- data:
Map<String, dynamic>{participantId:String, mode:String}
Important Changes Flutter SDK in Version v1.3.0
- The following modes have been deprecated:
CONFERENCEhas been replaced bySEND_AND_RECVVIEWERhas been replaced bySIGNALLING_ONLY
Please update your implementation to use the new modes.
⚠️ Compatibility Notice:
To ensure a seamless meeting experience, all participants must use the same SDK version.
Do not mix version v1.3.0 + with older versions, as it may cause significant conflicts.
Example
room.on(Events.participantModeChanged, (data) {
// do something
});
entryRequested
- This event will be emitted when a new participant, who is trying to join the room, is having permission
ask_joinin token. - This event will only be emitted to the participants in the room, who is having the permission
allow_joinin token. - This event will pass following parameters as an event parameters,
participantIdandnameof the new participant who is trying to join the room,allow()anddeny()to take required actions.
Event handler parameters
- data:
Map<String, dynamic>{ "allow": Function; "deny": Function; "name": String; "participantId": String }- allow: Function
- deny: Function
- name: String
- participantId: String
Example
room.on(Events.entryRequested, (data){
String? participantId = data["participantId"];
String? name = data["name"];
Function allow = data["allow"];
Function deny = data["deny"];
print("$name requested to join the room.");
// If you want to allow the entry request
allow();
// if you want to deny the entry request
deny();
});
entryResponded
- This event will be emitted when the
join()request is responded. - This event will be emitted to the participants in the room, who is having the permission
allow_joinin token. - This event will be also emitted to the participant, who requested to join the room.
Event handler parameters
- participantId: String
- decision: "allowed" | "denied"
Example
room.on(Events.entryResponded, (participantId, decision) {
// participantId will be id of participant, who requested to join room
if (decision === "allowed") {
// entry allowed
} else {
// entry denied
}
});
cameraRequested
- This event will be emitted to the participant
Bwhen any other participantArequests to enable camera of participantB. - On accepting the request, camera of participant
Bwill be enabled.
Event handler parameters
- data:
Map<String, dynamic>{ accept: Function; reject: Function }- accept: Function
- reject: Function
Example
room.on(Events.cameraRequested, (data) {
Function accept = data["accept"];
Function reject = data["deny"];
// if accept request
accept();
// if reject request
reject();
});
micRequested
- This event will be emitted to the participant
Bwhen any other participantArequests to enable mic of participantB. - On accepting the request, mic of participant
Bwill be enabled.
Event handler parameters
- data: Map<String, dynamic>{ accept: Function; reject: Function }
- accept: Function
- reject: Function
Example
room.on(Events.micRequested, (data) {
Function accept = data["accept"];
Function reject = data["reject"];
// if accept request
accept();
// if reject request
reject();
});
recordingStarted
This event will be deprecated soon
- This event will be emitted when recording of the room is started.
Example
room.on(Events.recordingStarted, () {
// do something
});
recordingStopped
This event will be deprecated soon
- This event will be emitted when recording of the room is stopped.
Example
room.on(Events.recordingStopped, () {
// do something
});
recordingStateChanged
- This event will be emitted when the meeting's recording status changed.
Event callback parameters
- status: String
status has following values
RECORDING_STARTING- Recording is in starting phase and hasn't started yet.RECORDING_STARTED- Recording has started successfully.RECORDING_STOPPING- Recording is in stopping phase and hasn't stopped yet.RECORDING_STOPPED- Recording has stopped successfully.
Example
room.on(Events.recordingStateChanged, (String status) {
log("Meeting recording status : $status");
});
liveStreamStarted
This event will be deprecated soon
- This event will be emitted when
RTMPlive stream of the room is started.
Example
room.on(Events.liveStreamStarted, () {
// do something
});
liveStreamStopped
This event will be deprecated soon
- This event will be emitted when
RTMPlive stream of the room is stopped.
Example
room.on(Events.liveStreamStopped, () {
// do something
});
livestreamStateChanged
- This event will be emitted when the meeting's livestream status changed.
Event callback parameters
- status: String
status has following values
LIVESTREAM_STARTING- Livestream is in starting phase and hasn't started yet.LIVESTREAM_STARTED- Livestream has started successfully.LIVESTREAM_STOPPING- Livestream is in stopping phase and hasn't stopped yet.LIVESTREAM_STOPPED- Livestream has stopped successfully.
Example
room.on(Events.liveStreamStateChanged, (String status) {
log("Meeting live streaming status : $status");
});
hlsStateChanged
- This event will be emitted when the meeting's HLS(Http Livestreaming) status changed.
Event callback parameters
- data: { status: String , playbackHlsUrl: String , livestreamUrl: String }
- status: String
- playbackHlsUrl: String
will receive this property only in HLS_STARTED status - livestreamUrl: String
will receive this property only in HLS_STARTED status
status has following values
HLS_STARTING- Hls is in starting phase and hasn't started yet.HLS_STARTED- Hls has started successfully.HLS_PLAYABLE- Hls has started can be played now, it will returnplaybaclHlsUrlandlivestreamUrl.HLS_STOPPING- Hls is in stopping phase and hasn't stopped yet.HLS_STOPPED- Hls has stopped successfully.
downstreamUrl is now depecated. Use playbackHlsUrl or livestreamUrl in place of downstreamUrl
Example
room.on(Events.hlsStateChanged, (Map<String, dynamic> data) {
toastMsg("Meeting HLS status : ${data['status']}");
if (data['status'] == "HLS_PLAYABLE"){
// [data] : { status: String, playbackHlsUrl: String, livestreamUrl: String }
log("PLAYBACKHLS URL -- " + data['playbackHlsUrl']);
}
});
hlsStarted
This event will be deprecated soon
- This event will be emitted when
HLSof the meeting is started.
Event callback parameters
- playbackHlsUrl: String
- livestreamUrl: String
Example
room.on(Events.hlsStarted, (String playbackHlsUrl, String livestreamUrl) => {
//
});
hlsStopped
This event will be deprecated soon
- This event will be emitted when
HLSof the meeting is stopped.
Example
room.on(Events.hlsStopped, () => {
//
});
transcriptionStateChanged
- This event will be triggered whenever state of realtime transcription is changed.
Event callback parameters
- data: { status: String, id: String }
- status: String
- id: String
status has following values
TRANSCRIPTION_STARTING- Realtime Transcription is in starting phase and hasn't started yet.TRANSCRIPTION_STARTED- Realtime Transcription has started successfully.TRANSCRIPTION_STOPPING- Realtime Transcription is in stopping phase and hasn't stopped yet.TRANSCRIPTION_STOPPED- Realtime Transcription has stopped successfully.
Example
room.on(Events.transcriptionStateChanged, (Map<String, dynamic> data) {
//Status can be :: TRANSCRIPTION_STARTING
//Status can be :: TRANSCRIPTION_STARTED
//Status can be :: TRANSCRIPTION_STOPPING
//Status can be :: TRANSCRIPTION_STOPPED
log("Meeting transcription status : ${data['status']}");
});
transcriptionText
- This event will be emitted when text for running realtime transcription received.
Example
room.on(Events.transcriptionText, (TranscriptionText data) {
var participantId = data.participantId;
var participantName = data.participantName;
var text = data.text;
var timestamp = data.timestamp;
var type = data.type;
print(
"Meeting Transcription started. Participant name: $participantName , Participant Id $participantId ");
});
error
- This event will be emitted when and error occurs in the room.
Example
room.on(Events.error, (error) {
log("VIDEOSDK ERROR :: " +
error['code'].toString() +
" :: " +
error['name'].toString() +
" :: " +
error['message'].toString());
});
whiteboardStarted
- This event will be emitted when a whiteboard session is succesfully started.
- It returns a
URLthat can be used to render the whiteboard in the app or in a web view.
Example
room.on(Events.whiteboardStarted, (url) {
// do something
});
whiteboardStopped
- This event will be emitted when a whiteboard session succesfully ends.
Example
room.on(Events.whiteboardStopped, () {
// do something
});
roomStateChanged
- This event is triggered whenever the room's state changes.
- The current state of the room is passed as a callback parameter.
- All available states are
connecting,connected,disconnected,reconnecting.
Event callback parameters
- state:
RoomState
Example
room.on(Events.roomStateChanged, (RoomState state) {
switch (state) {
case RoomState.connecting:
print('Meeting is Connecting');
break;
case RoomState.connected:
print('Meeting is Connected');
break;
case RoomState.disconnected:
print('Meeting connection disconnected abruptly');
break;
case RoomState.reconnecting:
print('Meeting in reconnection state');
default:
print('default');
}
});
pausedAllStreams
- This event is triggered when all or specified media streams within the meeting are successfully paused.
Parameters
kind: Specifies the type of media stream that was paused.- Type:
String - Possible values:
"audio": Indicates that audio streams have been paused."video": Indicates that video streams have been paused."share": Indicates that screen-sharing video streams have been paused.
- Type:
Example
room.on(Events.pausedAllStreams, (kind) {
print("Pause $kind Consumer");
});
resumedAllStreams
- This event is triggered when all or specified media streams within the meeting are successfully resumed.
Parameters
kind: Specifies the type of media stream that was resumed.- Type:
String - Possible values:
"audio": Indicates that audio streams have been resumed."video": Indicates that video streams have been resumed."share": Indicates that screen-sharing video streams have been resumed.
- Type:
Example
room.on(Events.resumedAllStreams, (kind) {
print("resumed $kind Consumer");
});
mediaRelayRequestReceived()
- This callback is triggered when a request is recieved for media relay in the destination meeting.
Parameters
-
peerId - (String): Specifies the participantId who requested the media relay. -
meetingId - (String): Specifies the meeting from where the media relay request was made. -
displayName - (String): Specifies the displayName of the participant who requested the media relay. -
accept - (Function): Specifies the function to accept the media relay request. -
reject - (Function): Specifies the function to reject the media relay request..
Example
room.on(Events.mediaRelayReceived, (meetingId, peerId, displayName, accept, reject) {
print("Media Realy received: ${displayName}");
});
mediaRelayRequestResponse()
- This callback is triggered when a response is recieved for media relay request in the source meeting.
Parameters
-
decidedBy - (String): Specifies the participantId who responded the request for the media relay. -
decision - (String): Specifies the decision whether the request for media relay was accepted or not. -
meetingId - (String): Specifies the meeting from where the media relay request was made.
Example
room.on(Events.mediaRelayResponse, (decidedBy, decision, meetingId) {
print("Media Realy response by: ${decidedBy}, decision: ${decision}, meetingId: ${meetingId}");
});
mediaRelayStarted()
- This callback is triggered when the media relay to the destination meeting succesfully starts.
Parameters
meetingId - (String): Specifies the meeting where the media relay started.
Example
_meeting.on(Events.mediaRelayStarted, (meetingId) {
print("Media relay started: $meetingId");
});
mediaRelayStopped()
- This callback is triggered when the media relay to the destination meeting stops for any reason.
Parameters
-
meetingId - (String): Specifies the meeting where the media relay stopped. -
reason - (String): Specifies the reason why the media relay stopped
Example
_meeting.on(Events.mediaRelayStopped, (meetingId, reason) {
String _reason = reason;
switch (_reason) {
case "user_stopped":
toastMsg("Media relay stopped");
break;
case "connection_lost":
toastMsg("Media relay ended");
break;
default:
toastMsg("Media relay stopped");
}
});
mediaRelayError()
- This callback is triggered when an error occurs during media relay to the destination meeting.
Parameters
-
meetingId - (String): Specifies the meeting where the media relay stopped. -
reason - (String): Specifies the reason why the media relay stopped
Example
room.on(Events.mediaRelayError, (meetingId, reason) {
print("Media Relay error: ${reason}");
});
Got a Question? Ask us on discord

