RTCStream Class Properties - Android
id
-
type:
String -
idis the id of the stream. It is also the key of the stream inparticipant.streams.
kind
-
type:
MediaType -
kindis 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 -
participantIdis the ID of the participant who publishes the stream.
track
-
type:
MediaStreamTrackfrom thevideosdk.org.webrtcpackage -
trackis the media track of the stream. Reading it again returns the same track. -
For
MediaType.VIDEOandMediaType.SHARE, it is aVideoTrack. Cast it and pass it toVideoView.addTrack()to render it. Don't draw it withaddSink(): the track can be a handle whoseaddSink()does nothing. -
For
MediaType.AUDIOandMediaType.SHARE_AUDIO, it is a handle, and casting it toVideoTrackthrows. The SDK plays remote audio itself, sosetVolume()andsetEnabled()on it don't change playback. To stop receiving a participant's audio, callpause()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

