Skip to main content
Version: 4.x.x

Stream Class Properties - iOS

id​

  • type: String

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


kind​

  • type: MediaType

  • kind represents the type of stream:

    • .audio: microphone audio
    • .video: camera video
    • .share: screen share
    • .shareAudio: screen-share audio

Example​

if stream.kind == .share {
// show the screen share in a larger view
}

participantId​

  • type: String

  • The id of the participant the stream belongs to.


isPaused​

  • type: Bool

  • true while the stream is paused for you: after you call pause(), or when the server pauses it, for example under adaptive subscription. Your own streams are never paused.


track​

  • type: RTCMediaStreamTrack

  • It represents the media track of the stream. It is an RTCVideoTrack for camera and screen-share streams, and an RTCAudioTrack for audio streams. These types come from VideoSDKRTC. See Video Rendering for their properties and methods.

  • To show a video stream, add an RTCMTLVideoView to the RTCVideoTrack with add(_:). Call remove(_:) when you stop showing it.

  • track.kind is .audio or .video. A screen-share track is .video too, so use the stream's kind to tell camera and screen share apart.

  • The SDK plays remote audio for you. Setting isEnabled to false on a remote participant's RTCAudioTrack asks the server to stop sending you that participant's audio, and true resumes it. To mute your own microphone, call muteMic() on the room.

Example​

import VideoSDKRTC

extension RoomViewController: ParticipantEventListener {
func onStreamEnabled(_ stream: RTCStream, forParticipant participant: Participant) {
if stream.kind == .video, let videoTrack = stream.track as? RTCVideoTrack {
participantVideoView.videoContentMode = .scaleAspectFill
videoTrack.add(participantVideoView)
}
}

func onStreamDisabled(_ stream: RTCStream, forParticipant participant: Participant) {
if stream.kind == .video, let videoTrack = stream.track as? RTCVideoTrack {
videoTrack.remove(participantVideoView)
}
}
}

videoTracks​

  • type: [RTCVideoTrack]

  • Holds the stream's video track for a camera or screen-share stream. It is empty for an audio stream.


audioTracks​

  • type: [RTCAudioTrack]

  • Holds the stream's audio track for an audio stream. It is empty for a camera or screen-share stream.

Got a Question? Ask us on discord