Skip to main content

The Participant object

The DyteMeetingParticipant object consists of all the information related to a particular participant. For instance, it contains a participants video/audio/screenshare stream, and the participant's name. It also contains state variables that indicate whether a participant's camera is on or off, and whether they are muted or unmuted.

The participant object has the following properties.

  • id: The participantId of the participant (aka peerId).
  • userId: The userId of the participant.
  • name: Contains participant's name.
  • picture: Contains participant's picture (if any).
  • isHost: Boolean value indicating whether this user is host of current meeting or not.
  • clientSpecificId: Arbitrary ID that can be set to identify the participant.
  • videoEnabled: Set to true if the participant's camera is on.
  • audioEnabled: Set to true if the participant is unmuted.

You can subscribe to various participants events. For subscribing:

  • Implement DyteParticipantEventsListener to a class say ParticipantEventListener, and listen to event from DyteParticipantEventsListener by overriding them. This class can be user to manage your state in the application.
class ParticipantEventListener extends DyteParticipantEventsListener {


void onAudioUpdate({
required bool audioEnabled,
required DyteJoinedMeetingParticipant participant,
}) {
/// handle audioUpdate of `DyteJoinedMeetingParticipant` participant
}


void onActiveSpeakerChanged(DyteJoinedMeetingParticipant participant) {
/// handle active speaker changing to `DyteJoinedMeetingParticipant` participant
}


void onNoActiveSpeaker() {
/// handle no active speaker
}


void onParticipantPinned(DyteJoinedMeetingParticipant participant) {
/// handle pinning of `DyteJoinedMeetingParticipant` participant
}



void onParticipantUnpinned(DyteJoinedMeetingParticipant participant) {
/// handle unpinning the pinned participant
}


void onScreenShareStarted(DyteJoinedMeetingParticipant participant) {
/// handle screen share started of `DyteJoinedMeetingParticipant` participant
}


void onScreenShareEnded(DyteJoinedMeetingParticipant participant) {
/// handle screen share ended of `DyteJoinedMeetingParticipant` participant
}


void onVideoUpdate({
required bool videoEnabled,
required DyteJoinedMeetingParticipant participant,
}) {
/// handle videoUpdate of `DyteJoinedMeetingParticipant` participant
}

}
  • Now to subscribe, pass the instance of DyteParticipantEventsListener class created above to addParticipantEventsListener() method of dyteClient instance as follows:
dyteClient.addParticipantEventsListener(ParticipantEventListener());

Audio/Video updates for participant


...


void onVideoUpdate(bool videoEnabled) {
if (videoEnabled) {
// video is enabled, and other participants in room can see local user
} else {
// video is disabled, and other participants in room can not see local user.
}
}


void onAudioUpdate({
required bool audioEnabled,
required DyteJoinedMeetingParticipant participant,
}) {
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
}

...

Host controls methods

If you (the local user) have the relevant permissions in the meeting, you can disable a participant's video/audio streams, or even remove them from the meeting.

final participant = meeting.participants.joined.first;

// To disable a participant's video stream
participant.disableVideo();

// To disable a participant's audio stream
participant.disableAudio();

// To kick a participant from the meeting
participant.kick();

// to pin a participant in a meeting
participant.pin();