Skip to main content
Version: 1.1.x

Media Events - Flutter

VideoSDK offers various events that can be monitored to obtain information about the media status of participants in the meeting.

Here are the events specifically related to the stream:

Events.streamEnabled

  • This event is triggered whenever a participant's video, audio or screen share stream is enabled.
  • It can be subscribed to using the Participant object.

Events.streamDisabled

  • This event is triggered whenever a participant's video, audio or screen share stream is disabled.
  • It can be subscribed to using the Participant object.

Events.streamPause

  • This event is triggered whenever a participant's video, audio or screen share stream is paused.
  • It can be subscribed to using the Participant object.

Events.streamResumed

  • This event is triggered whenever a participant's video, audio or screen share stream is resumed.
  • It can be subscribed to using the Participant object.

Example

Here is an example demonstrating the usage of all the events mentioned on this page.

import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';

class ParticipantTile extends StatefulWidget {
final Participant participant;
//Existing congiguration
}

class _ParticipantTileState extends State<ParticipantTile> {
@override
void initState() {
//Existing congiguration

setupParticipantEventListener();
}

@override
Widget build(BuildContext context) {
return YourParticipantTileWidget();
}

void setupParticipantEventListener() {
widget.participant.on(Events.streamEnabled, (Stream stream) {
if (stream.kind == "video") {
// Participant turned on video
} else if (stream.kind == "audio") {
// Participant turned on audio
} else if (stream.kind == "share") {
// Participant started screenshare
}
});

widget.participant.on(Events.streamDisabled, (Stream stream) {
if (stream.kind == "video") {
// Participant turned off video
} else if (stream.kind == "audio") {
// Participant turned off audio
} else if (stream.kind == "share") {
// Participant stopped screenshare
}
});

widget.participant.on(Events.streamPaused, (Stream stream) {
if (stream.kind == "video") {
// Participant video pause
} else if (stream.kind == "audio") {
// Participant audio pause
} else if (stream.kind == "share") {
// Participant screenshare paused
}
});

widget.participant.on(Events.streamResumed, (Stream stream) {
if (stream.kind == "video") {
// Participant video resume
} else if (stream.kind == "audio") {
// Participant audio resume
} else if (stream.kind == "share") {
// Participant screenshare resumed
}
});
}
}

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord