Skip to main content
Version: 3.x.x

RTCStream Class Properties - Android

id​

  • type: String

  • id is the id of the stream. It is also the key of the stream in participant.streams.


kind​

  • type: MediaType

  • kind is the type of stream:

    • MediaType.AUDIO: the microphone.
    • MediaType.VIDEO: the camera.
    • MediaType.SHARE: the screen share.
    • MediaType.SHARE_AUDIO: the audio shared with the screen, sent by participants on other platforms. An Android sharer mixes it into the microphone stream instead.

participantId​

  • type: String

  • participantId is the ID of the participant who publishes the stream.


track​

  • type: MediaStreamTrack from the videosdk.org.webrtc package

  • track is the media track of the stream. Reading it again returns the same track.

  • For MediaType.VIDEO and MediaType.SHARE, it is a VideoTrack. Cast it and pass it to VideoView.addTrack() to render it. Don't draw it with addSink(): the track can be a handle whose addSink() does nothing.

  • For MediaType.AUDIO and MediaType.SHARE_AUDIO, it is a handle, and casting it to VideoTrack throws. The SDK plays remote audio itself, so setVolume() and setEnabled() on it don't change playback. To stop receiving a participant's audio, call pause() on the stream.

Example​

import videosdk.org.webrtc.VideoTrack

class ParticipantViewListener(private val videoView: VideoView) : ParticipantEventListener() {
override fun onStreamEnabled(stream: RTCStream) {
if (stream.kind == MediaType.VIDEO) {
videoView.addTrack(stream.track as VideoTrack)
}
}
}

Got a Question? Ask us on discord


Was this helpful?

Not helpfulHelpful