Events
Local User - Events
You can subscribe to various events on the local user by implementing DyteSelfEventsListener
and passing the object to meeting.addSelfEventsListener(dyteSelfEventsListener)
.
Video update
Triggered when the user starts/stops the video using enableVideo()
or
disableVideo()
.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onVideoUpdate(videoEnabled: Boolean) {
if (videoEnabled) {
// video is enabled, and other participants in room can see local user
} else {
// video is disabled, and other participants in room can not see local user.
}
}
})
Audio update
Triggered when the user starts/stops the audio using enableAudio()
or
disableAudio()
.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onAudioUpdate(audioEnabled: Boolean) {
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
}
})
Proximity changed
Triggered whenever there is a change in proximity, indicating if the device is near an earpiece, which subsequently causes the display to turn on or off.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onProximityChanged(isNear: Boolean) {
// if `isNear` is true, display should be turned off, as user might be speaking through earpiece
// if false, display should be turned on, as user might be looking at display and listening through speaker/earphones.
}
})
Waitlist status
For meetings whose waiting room is enabled:
To get status of localUser in waiting room we can use
val waitListStatus = meeting.localUser.waitListStatus
You can listen to those changes in onWaitListStatusUpdate()
callbacks
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onWaitListStatusUpdate(waitListStatus: WaitListStatus) {
// handle waitlist status here
}
});
Process message within a room
Manage messages among participants within a room.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onRoomMessage(type: String, payload: Map<String, *>) {
// handle the message here
}
});
Screenshare callbacks for local user
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onScreenShareStartFailed(reason: String) {
// screenshare failed to start
}
override fun onScreenShareStarted() {
// screenshare started presenting in the meeting
}
override fun onScreenShareStopped() {
// screenshared stopped by the local user
}
});
Device permission callbacks once local user is joined in the meeting
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onMeetingRoomJoinedWithoutCameraPermission() {
// local user joined without camera permission
}
override fun onMeetingRoomJoinedWithoutMicPermission() {
// local user joined without microphone permission
}
});
When local user is kicked out from the meeting by a remote user
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onRemovedFromMeeting() {
// removed from meeting
}
});