The participant object
The data regarding all meeting participants is stored under meeting.participants
. Use the methods and events to consume the participants data.
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).customParticipantId
: An arbitrary 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 View which further
can used to add in any ViewGroup in android.
Similarly one can use participant.getScreenShareVideoView()
which will return a
View which further can used to add in any ViewGroup in android.
Similarly, you can also access the pagination related information like follows:
- Kotlin
- Java
val maxNumberOnScreen = meeting.participants.maxNumberOnScreen
val currentPageNumber = meeting.participants.currentPageNumber
val pageCount = meeting.participants.pageCount
val canGoNextPage = meeting.participants.canGoNextPage
val canGoPreviousPage = meeting.participants.canGoPreviousPage
int maxNumberOnScreen = meeting.participants.getMaxNumberOnScreen();
int currentPageNumber = meeting.participants.getCurrentPageNumber();
int pageCount = meeting.participants.getPageCount();
boolean canGoNextPage = meeting.participants.getCanGoNextPage();
boolean canGoPreviousPage = meeting.participants.getCanGoPreviousPage();
Move between pages in paginated mode
The setPage
method allows you to switch between pages of participants present in the meeting.
- Kotlin
- Java
// switch to 1st page
meeting.participants.setPage(1)
// 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.
- Kotlin
- Java
val participant = meeting.participants.joined.firstOrNull { it.id == participantId }
participant?.let { pcpt ->
// To disable a participant's video stream
pcpt.disableVideo()
// To disable a participant's audio stream
pcpt.disableAudio()
// To kick a participant from the meeting
pcpt.kick()
}
Optional<DyteRemoteParticipant> participant = meeting.getParticipants().getJoined()
.stream()
.filter(pcpt -> pcpt.getId().equals(participantId))
.findFirst();
participant.ifPresent(pcpt -> {
// To disable a participant's video stream
pcpt.disableVideo();
// To disable a participant's audio stream
pcpt.disableAudio();
// To kick a participant from the meeting
pcpt.kick();
});
You can also pin
or unpin
a participant in the meeting. All "pinned"
participants are added to the meeting.participants.pinned
list.
- Kotlin
- Java
val participant = meeting.participants.joined.firstOrNull { it.id == participantId }
participant?.let { pcpt ->
// To pin a participant
pcpt.pin();
// To unpin a participant
pcpt.unpin();
}
Optional<DyteRemoteParticipant> participant = meeting.getParticipants().getJoined()
.stream()
.filter(pcpt -> pcpt.getId().equals(participantId))
.findFirst();
participant.ifPresent(pcpt -> {
// To pin a participant
pcpt.pin();
// To unpin a participant
pcpt.unpin();
});
Broadcast message to all participants
Send a message to all joined
participants.
Parameters:
type
: A client-specific type to differentiate between custom messages like "emoji" or "greetings"
payload
: A Map containing the message payload, of type Map<String, Any>
.
- Kotlin
- Java
// broadcast message
meeting.participants.broadcastMessage(type, payload)
// broadcast message
meeting.participants.broadcastMessage(type, payload);