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
: TheparticipantId
of the participant (akapeerId
).userId
: TheuserId
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.
Similarly one can use participant.getScreenShareView()
which will return a
View which further can used to add in any view.
Host Controls
If you are the host of the room, you can use the host controls. The host controls allow you to manage the participants in the room.
The host controls include the following options:
- Mute/Unmute: Mute or unmute a participant.
- Kick: Kick a participant from the room.
- Pin: Pin a participant's video.
- Turn off video: Turn off a participant's video.
You can also use these methods from our participant object to perform these actions programmatically.
if let participant = meeting.participants.joined.first(where: { $0.id == participantId }) {
// 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()
}
Waiting Room
Host can use these waiting room methods from our participant object to perform these actions programmatically.
// Accept the request and let the participant in the meeting
participant.acceptWaitListedRequest()
// Reject the request, do not permit the participant to join the meeting
participant.rejectWaitListedRequest()
pin/unpin
You can also pin
or unpin
a participant in the meeting. All "pinned"
participants are added to the meeting.participants.pinned
.
if let participant = meeting.participants.joined.first(where: { $0.id == participantId }) {
// To pin a participant
participant.pin()
// To unpin a participant
participant.unpin()
}
Move between pages in paginated mode
The setPage(pageNumber: Int)
method allows you to switch between pages of
participants present in the meeting.
// switch to 1st page
meeting.participants.setPage(1)
Broadcast message to all participants
Send a broadcast message to all joined
participants
Parameters:
type
: A client-specific type to differentiate between custom messages like "emoji" or "greetings"
payload
: A dictionary containing the message payload, where keys are strings and values are of any type.
// broadcast message
meeting.participants.broadcastMessage(type, payload)
Receiving Broadcast messages
To be able to receive broadcast messages you need to implement a method
onRoomMessage
method from callback DyteSelfEventsListener
. You can
subscribe to this events by calling
meeting.addChatEventsListener(dyteSelfEventsListener)
check this dyteSelfEventsListener broadcastMessage documentation