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)
.
Room joined
Triggered when the room join event completes and now the meeting is ready to produce and consume media.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onRoomJoined() {
super.onRoomJoined()
}
});
Video update
Triggered when the user starts / stops the video using enableVideo
or
disableVideo
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onVideoUpdate(videoEnabled: Boolean) {
super.onVideoUpdate(videoEnabled)
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) {
super.onAudioUpdate(videoEnabled)
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.
}
}
})
Room disconnected update
Triggered when the user is disconnected due to media/network errors
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onMeetingRoomDisconnected() {
super.onMeetingRoomDisconnected()
}
})
Proximity changed
Triggered when there is any change in proximity. Meaning if device is near ear piece which triggers display on/off.
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onProximityChanged(isNear: Boolean) {
super.onProximityChanged(isNear)
// isNear
// if true, display should be turned off, as user might be speaking through earpience
// if false, display should be tunred 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
Developers can listen to those changes in onWaitListStatusUpdate()
callbacks
meeting.addSelfEventsListener(object : DyteSelfEventsListener {
override fun onWaitListStatusUpdate(waitListStatus: WaitListStatus) {
super.onWaitListStatusUpdate(waitListStatus)
}
});