onStreamEnabled

fun onStreamEnabled(stream: Stream)

Called when a new media stream is enabled for this participant.

This callback is invoked when the participant turns on their microphone, webcam, or starts screen sharing. Use getKind to determine the type of stream.

Code Example:


override fun onStreamEnabled(stream: Stream) {
    if (stream.kind.equals("video", ignoreCase = true)) {
        val videoTrack = stream.track as VideoTrack
        videoTrack.addSink(videoView)
    } else if (stream.kind.equals("audio", ignoreCase = true)) {
        // Audio stream enabled
    } else if (stream.kind.equals("share", ignoreCase = true)) {
        // Screen share stream enabled
    }
}

Parameters

stream

the Stream that was enabled

See also