onMediaStatusChanged

open fun onMediaStatusChanged(participantId: String, kind: MediaType, newStatus: Boolean)

Called when this participant turns their microphone, camera or screen share on or off, whether or not this device receives it. Fired on the main thread.

In a room joined with createRoom(autoConsume = false) it is the cue to call Participant.consumeMicStreams or Participant.consumeWebcamStreams: onStreamEnabled only fires for media this device receives.

Code Example:

participant.addEventListener(object : ParticipantEventListener() {
override fun onMediaStatusChanged(participantId: String, kind: MediaType, newStatus: Boolean) {
if (kind == MediaType.VIDEO && newStatus) {
lifecycleScope.launch { participant.consumeWebcamStreams() }
}
}
})

Parameters

participantId

the participant whose media changed.

kind

which media changed.

newStatus

true when it was turned on.