Participant Events - Android
These RoomEventListener events tell you about the participants in the room. Override the ones you need and register the listener with room.addEventListener().
onParticipantJoined
- This event is triggered when someone joins the room and returns the
Participantobject as a parameter.
onParticipantLeft
- This event is triggered when someone leaves the room.
- It also passes a
LeaveReasonthat tells you why. The reason isUNKNOWNwhen the server does not send one.
onWebcamRequested
- This event will be triggered to the participant
Bwhen any other participantArequests to enable webcam of participantB. - On accepting the request, webcam of participant
Bwill be enabled. - Rejecting the request does not notify participant
A.
onMicRequested
- This event will be triggered to the participant
Bwhen any other participantArequests to enable mic of participantB. - On accepting the request, mic of participant
Bwill be enabled. - Rejecting the request does not notify participant
A.
Example
Here is the usage of all the events mentioned in this page.
private val roomEventListener: RoomEventListener = object : RoomEventListener() {
override fun onParticipantJoined(participant: Participant) {
Log.d("VideoSDK", participant.displayName + " joined")
}
override fun onParticipantLeft(participant: Participant, reason: LeaveReason) {
Log.d("VideoSDK", participant.displayName + " left: " + reason.message)
}
override fun onWebcamRequested(participantId: String, listener: WebcamRequestListener) {
// participantId, will be the id of participant who requested to enable webcam
// if accept request
listener.accept()
// if reject request
listener.reject()
}
override fun onMicRequested(participantId: String, listener: MicRequestListener) {
// participantId, will be the id of participant who requested to enable mic
// if accept request
listener.accept()
// if reject request
listener.reject()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
//...
// add listener to room
room!!.addEventListener(roomEventListener)
}
API Reference
The API references for all the methods and events utilised in this guide are provided below.
Got a Question? Ask us on discord

