Skip to main content

The participant object

The participant 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: The participant's name.
  • picture: The participant's picture (if any).
  • clientSpecificId: An arbitrary ID that can be set to identify the participant.
  • videoTrack: The video track of the participant.
  • screenShareTrack: The video and audio (if any) track of the participant's screen share stream.
  • videoEnabled: Set to true if the participant's camera is on.
  • audioEnabled: Set to true if the participant is unmuted.
  • isPinned: True if current user is pinned in the meeting room.
  • presetName: Name of the preset associated with the participant.
  • stageStatus: Status of stage for the participant

To get Video view of a given participant

You can call participant.getVideoView() which will return a View which further can used to add in any View Group in android.

Similarly one can use participant.getScreenShareView() which will return a View which further can used to add in any View Group in android.

Audio/Video updates for participant

You can listen to audio/video changes for a single participant by calling addParticipantUpdateListener(listener: DyteParticipantUpdateListener) on any participant object.

dyteParticipant.addParticipantUpdateListener(object : DyteParticipantUpdateListener {
override fun onAudioUpdate(participant: DyteMeetingParticipant, isEnabled: Boolean) {
// on audio update
}

override fun onVideoUpdate(participant: DyteMeetingParticipant, isEnabled: Boolean) {
// on video update
}

override fun onScreenShareStarted(participant: DyteMeetingParticipant) {
// when participant start to screenshare
}

override fun onScreenShareEnded(participant: DyteMeetingParticipant) {
// when participant stops screenshare
}

override fun onPinned() {
// when participant is pinned
}

override fun onUnpinned() {
// when participant is unpinned
}

override fun onSetAsActiveSpeaker() {
// when participant set to active speaker
}

override fun onRemovedAsActiveSpeaker() {
// when participant is no longer active speaker
}
})

Also make sure to remove event listener when they are no longer used. You can remove DyteParticipantUpdateListener by calling removeParticipantUpdateListener(listener)

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.

val participant = meeting.participants.joined.get(0);

// 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();

// to retrieve if current participant is already pinned in a meeting
participant.isPinned