Skip to main content
Version: 3.x.x

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 Participant object as a parameter.

onParticipantLeft​

  • This event is triggered when someone leaves the room.
  • It also passes a LeaveReason that tells you why. The reason is UNKNOWN when the server does not send one.

onWebcamRequested​

  • This event will be triggered to the participant B when any other participant A requests to enable webcam of participant B.
  • On accepting the request, webcam of participant B will be enabled.
  • Rejecting the request does not notify participant A.

onMicRequested​

  • This event will be triggered to the participant B when any other participant A requests to enable mic of participant B.
  • On accepting the request, mic of participant B will 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