Skip to main content
Version: 1.1.x

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 Participant object as parameter.
  • It can be subscribed to using the Room object.

Events.participantLeft

  • This event is triggered when someone leaves the meeting.
  • It can be subscribed to using the Room object.

Events.cameraRequested

  • This event is triggered for participant B, when another participant, A requests to enable their webcam.
  • Upon accepting the request, participant B's webcam will be enabled.
  • It can be subscribed to using the Room object.

Events.micRequested

  • This event is triggered for participant B, when another participant, A requests to enable their mic.
  • Upon accepting the request, participant B's mic will be enabled.
  • It can be subscribed to using the Room object.

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) {
// 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