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.

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.

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

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(participantUpdateListener: self)

extension MeetingViewModel: DyteParticipantUpdateListener {
func onAudioUpdate(participant: DyteMeetingParticipant, isEnabled: Bool) {
// on audio update
}

func onVideoUpdate(participant: DyteMeetingParticipant, isEnabled: Bool) {
// on video update
}

func onPinned(participant: DyteMeetingParticipant) {
// when participant is pinned
}

func onUnpinned(participant: DyteMeetingParticipant) {
// when participant is un-pinned
}

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

func onScreenShareEnded(participant: DyteMeetingParticipant) {
// 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.

let 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()

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