Participant Video Stream - Flutter
- Using this feature, you can pause/resume participant's video stream.
Pause video stream
pause()
method is used to pause videostream of a participant.
ElevatedButton(
child: Text("Pause Video"),
onPressed: () {
List<Stream> streams = participant.streams.where((e) => e.kind == 'video').toList();
if(streams.length != 0){
Stream videoStream = streams[0];
videoStream.track.pause();
}
}
),
Resume video stream
resume()
method is used to resume videostream of a participant.
ElevatedButton(
child: Text("Resume Video"),
onPressed: () {
List<Stream> streams = participant.streams.where((e) => e.kind == 'video').toList();
if(streams.length != 0){
Stream videoStream = streams[0];
videoStream.track.resume();
}
}
),
Events
Event associated with pause()
:
streamPaused
event will be emitted withstream
object from the event callback, inside that participant object.
Event associated with resume()
:
streamResumed
event will be emitted withstream
object from the event callback, inside that participant object.
participant.on(Events.streamPaused, (Stream stream){
if (stream.kind === "video") {
//particiapnt video stream paused
}
});
participant.on(Events.streamResumed, (Stream stream){
if (stream.kind === "video") {
//particiapnt video stream resumed
}
});
Got a Question? Ask us on discord