Room Events - Flutter
VideoSDK provides several types of events that can be listened to in order to determine the current state of the room.
Here are the events specifically related to the room:
Events.roomJoined
- This event is triggered when the room is successfully joined.
 - It can be subscribed to using the 
Roomobject. 
Events.roomLeft
- This event is triggered when the room is left.
 - It can be subscribed to using the 
Roomobject. 
Events.speakerChanged
- This event is triggered when there is a change in the active speaker during the meeting.
 - It can be subscribed to using the 
Roomobject. 
Events.presenterChanged
- This event is triggered when there is a change in the presenter during the meeting.
 - 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.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

