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 meering roomm

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.

Similarely 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) {
super.onAudioUpdate(participant, isEnabled)
// on audio update
}

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

override fun onPinned(participant: DyteMeetingParticipant) {
super.onPinned(participant)
// when participant is pinned
}

override fun onUnpinned(participant: DyteMeetingParticipant) {
super.onUnpinned(participant)
// when participant is un-pinned
}

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

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

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