RTCStream class
One audio, video or screen-share stream from a participant.
Streams arrive with Events.streamEnabled on the room and are listed in Participant.streams. Show a video or screen-share stream by passing its renderer to an RTCVideoView.
Example
room.on(Events.streamEnabled, (RTCStream stream) {
if (stream.kind == MediaType.VIDEO) {
setState(() => videoStream = stream);
}
});
// in build():
RTCVideoView(videoStream!.renderer!);
// stop receiving it while its tile is off screen:
await videoStream!.pause();
See also:
- Participant, which produces streams
- Room, which manages all streams in a room
Properties
- id ↔ String
-
The stream's id — its key in Participant.streams.
getter/setter pair
- isLocal ↔ bool
-
Whether this stream belongs to the local participant.
latefinal
- kind ↔ MediaType
-
Audio, video or screen share.
getter/setter pair
- participantId → String
-
The id of the participant this stream belongs to.
no setter
- renderer ↔ RTCVideoRenderer?
-
The renderer to pass to an RTCVideoView;
nullfor audio streams.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
off(
Events event, Function handler) → void - Removes a handler added with on.
-
on(
Events event, Function handler) → void -
Subscribes
handlertoeventon this stream. Only Events.streamStateChanged is delivered here, with(state, timestamp). -
pause(
) → Future< void> - Stops receiving this stream from a remote participant — to save bandwidth while its tile is off screen, for example. resume starts it again.
-
resume(
) → Future< void> - Starts receiving a stream that pause stopped.