Media Events - Android
These ParticipantEventListener events tell you about a participant's media. Override the ones you need and register the listener with participant.addEventListener().
onStreamEnabled
- This event is triggered whenever a participant's video, audio or screen share stream is enabled.
- When you add the listener, this event also fires straight away, on the calling thread, for every stream the participant already has. Don't also loop over
participant.streamsto render them, or each stream is handled twice.
onStreamDisabled
- This event is triggered whenever a participant's video, audio or screen share stream is disabled.
onMediaStatusChanged
- This event is triggered whenever a participant turns their mic, webcam or screen share on or off, even when this device does not receive that media.
- It passes the
participantId, thekindof media (aMediaType:AUDIO,VIDEO,SHAREorSHARE_AUDIO) andnewStatus, which istruewhen the media was turned on. onStreamEnabledfires only for media this device receives. In a room created withcreateRoom(autoConsume = false), use this event as the cue to callconsumeMicStreams()orconsumeWebcamStreams().
Stream state
- To follow the health of a remote video or screen share stream, call
setOnStreamStateChangedListener()on theRTCStreamthatonStreamEnableddelivers. The listener is called on the main thread with aStreamState:FREEZE_DETECTED: the picture has stopped moving.FREEZE_RESOLVEDfollows once frames have flowed again for five seconds.STUCK: nothing has arrived on the stream for five seconds.ACTIVE/ENDED: the server resumed or closed the stream.
- Only remote video and screen share streams report a state. Audio streams never do.
- A stream that is enabled again is a new
RTCStream, so set the listener in everyonStreamEnabled. Passnullto remove it.
Example
Here is the usage of all the events mentioned in this page.
participant.addEventListener(object : ParticipantEventListener() {
override fun onStreamEnabled(stream: RTCStream) {
Log.d("VideoSDK", "onStreamEnabled $stream")
stream.setOnStreamStateChangedListener { state ->
Log.d("VideoSDK", "${stream.kind} stream of ${stream.participantId}: $state")
}
}
override fun onStreamDisabled(stream: RTCStream) {
Log.d("VideoSDK", "onStreamDisabled $stream")
}
override fun onMediaStatusChanged(participantId: String, kind: MediaType, newStatus: Boolean) {
Log.d("VideoSDK", "onMediaStatusChanged $participantId $kind $newStatus")
}
})
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

