Skip to main content

Introduction - Participants

The participants property on RealtimeKitClient provides access to remote participants in your RealtimeKit meeting. This whole module helps you manage participant data and listen to participant state changes. It is of type RtkParticipants and can be accessed as follows:

// Access the participants object
final participants = meeting.participants;
NOTE

This object only contains data for remote participants and doesn't include your local user. For local user properties and controls, use the meeting.localUser property instead.

Participant Lists

RealtimeKit organizes remote participants into different lists based on their current state in the meeting.

ListDescriptionUse Case
joinedAll remote participants currently in the meetingDisplaying participant lists, user counts
activeParticipants whose media is subscribed and should be displayed on the screenBuilding video grids, active speaker views
waitlistedParticipants waiting for approval to join the meetingImplementing waiting room interfaces
screenSharesParticipants currently sharing their screenDisplaying active screen shares

Each remote participant is represented as an RtkRemoteParticipant object, containing their properties and available actions.

// Example: Access all remote participants in the meeting
final joinedParticipants = meeting.participants.joined;

// Example: Access active participants for a video grid
final activeParticipants = meeting.participants.active;

Additional Properties

  • totalCount: Total number of participants present in the meeting, including the local user.
  • pinned: Currently pinned participant, or null if no participant is pinned.
// Get the total participant count
final totalParticipants = meeting.participants.totalCount;
print("Meeting has $totalParticipants participants");

// Check and use pinned participant
final pinnedParticipant = meeting.participants.pinned;
if (pinnedParticipant != null) {
print("${pinnedParticipant!.name} is pinned");
}

Event Handling

The participants module provides RtkParticipantsEventListener interface to notify you about changes to participants. For detailed information on available events, see the Events documentation.

// Example: Listening to Participants events

// Implement RtkParticipantEventsListener interface
class ParticipantsEventListener extends RtkParticipantEventsListener {
...

void onParticipantJoin(RtkRemoteParticipant participant) {
// your code here to handle new participant
}
...
}

// Add ParticipantsEventListener listener to meeting
final participantsEventListener = ParticipantsEventListener()
meeting.addParticipantsEventListener(participantsEventListener);

Broadcasting Messages

RealtimeKit allows you to broadcast custom messages to all participants in the meeting. This enables real-time interactions like emoji reactions, custom notifications.

The broadcast system uses two parameters:

  • type: String identifier for categorizing messages. This helps receivers filter and process messages based on their type
  • payload : JSON-serializable map (Map<String, dynamic>) containing your custom data

Send a custom message to all participants using broadcastMessage:

// Broadcast a greeting to everyone in the meeting
final payload = {
'message': 'Hello everyone!',
};
meeting.participants.broadcastMessage('custom_type', payload);

To receive these broadcast messages, implement the onNewBroadcastMessage callback in your Participants event listener. See the Events documentation for details on handling broadcast messages.