Room Events - Flutter
VideoSDK provides multiple types of events which can be listened to know the current state of the room.
Here are the events which specifically relate to the meeting.
Events.roomJoined​
- This event is triggered when the room is successfully joined.
- This event can be subscribed from the
Room
object.
Events.roomLeft​
- This event is triggered when the room is left.
- This event can be subscribed from the
Room
object.
Events.speakerChanged​
- This event is triggered when the active speaker in the room gets changed.
- This event can be subscribed from the
Room
object.
Events.presenterChanged​
- This event is triggered when the presenter in the room gets changed.
- This event can be subscribed from the
Room
object.
Example​
Here is the usage of all the events mentioned in this page.
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class MeetingScreen extends StatefulWidget {
...
}
class _MeetingScreenState extends State<MeetingScreen> {
late Room room;
@override
void initState() {
...
setupRoomEventListener();
}
@override
Widget build(BuildContext context) {
return YourMeetingWidget();
}
void setupRoomEventListener() {
room.on(Events.roomJoined, () {
//Room Joined successfully
});
room.on(Events.roomLeft, (String? error) {
//Room Left
if(error != null) {
// Room left with error
}
});
room.on(Events.speakerChanged, (String? activeSpeakerId) {
//Room active speaker has changed
//Participant ID of current active speaker is activeSpeakerId
});
room.on(Events.presenterChanged, (String? presenterId) {
//Room screen presenter has changed
//Participant ID of current presenter is presenterId
});
}
}
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