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
- participant: Participant
Example
room.on(Events.participantLeft, (participant) {
// 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
null
as 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
participantId
as an event handler parameter. - If a participant stops screen-sharing, then this event will pass
null
as 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
, andpinnedBy
asMap<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 will be emitted when any participant mode gets changed.
- It will pass
participantId
, andpinnedBy
asMap<String, dynamic>
as an event handler parameter.
Event handler parameters
- data:
Map<String, dynamic>
{participantId:String, mode:String}
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_join
in token. - This event will only be emitted to the participants in the room, 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 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_join
in 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
}
});