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: TheparticipantIdof the participant (akapeerId).userId: TheuserIdof the participant.name: The participant's name.picture: The participant's picture (if any).customParticipantId: A customizable 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.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 UIView that renders
the participant's video stream.
Similarly one can use participant.getScreenShareVideoView() which will return a
UIView that renders the participant's screenshare stream.
You can also access pagination related information:
let maxNumberOnScreen = meeting.participants.maxNumberOnScreen
let currentPageNumber = meeting.participants.currentPageNumber
let pageCount = meeting.participants.pageCount
let canGoNextPage = meeting.participants.canGoNextPage
let canGoPreviousPage = meeting.participants.canGoPreviousPage
Move between pages in paginated mode
The setPage method allows you to switch between pages of participants present in the meeting.
// switch to 1st page
meeting.participants.setPage(1)
Host Controls
If you (the local user) have the relevant permissions, you can disable a participant's video or audio, or kick them from the meeting.
All methods return an optional HostError which is non-null if the operation fails.
if let participant = meeting.participants.joined.first(where: { $0.id == participantId }) {
// To disable a participant's video stream
let videoError: HostError? = participant.disableVideo()
// To disable a participant's audio stream
let audioError: HostError? = participant.disableAudio()
// To kick a participant from the meeting
let kickError: HostError? = participant.kick()
}
You can also pin or unpin a participant in the meeting. All "pinned" participants are added to the meeting.participants.pinned list.
The methods return an optional HostError which is non-null if the operation fails.
if let participant = meeting.participants.joined.first(where: { $0.id == participantId }) {
// To pin a participant
val pinError: HostError? = participant.pin()
// To unpin a participant
val unpinError: HostError? = participant.unpin()
}
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
Implement the onNewBroadcastMessage method of RtkParticipantsEventListener to receive broadcast messages.
extension MeetingViewModel: RtkParticipantsEventListener {
func onNewBroadcastMessage(type: String, payload: [String : Any]) {
}
}