Share Your Screen - Flutter
-
Whenever any participant wants to share a complete screen of mobile, they can simply do it with VideoSDK Meeting.
-
This guide will provide an overview of how to enable or disable Screen Share in a meeting.
Enable Screen Share​
-
Meeting
class provides the method to enable screen-sharing. -
In order to start screen-sharing just call
meeting.enableScreenShare()
method.
ElevatedButton(
child: Text("Start ScreenSharing"),
onPressed: () {
meeting.enableScreenShare();
},
),
Customise notification​
-
When a presenter starts screen share, presenter will receive a notification with a pre-defined title and messages.
-
You can Customise those title, message and icon as per your requirements using
NotificationInfo
class and passed toMeetingBuilder
.
MeetingBuilder(
.
.
notification: const NotificationInfo(
title: "Video SDK",
message: "Video SDK is sharing screen in the meeting",
icon: "notification_share", // drawable icon name
),
),
Disable Screen Share​
By using meeting.disableScreenShare()
function, a participant can stop publishing screen stream to other participants.
ElevatedButton(
child: Text("Stop ScreenSharing"),
onPressed: () {
meeting.disableScreenShare();
},
),
Display Screen Share Stream​
Local Participant​
When a Local participant share the screen, streamEnabled
Event on the Participant
is triggered with the Stream
which can be added to a RTCVideoView
.
meeting.localParticipant.on(Events.streamEnabled, (Stream _stream) {
if (_stream.kind == 'share') {
screenShareStream = _stream;
}
});
Other Participants​
When other participant(Except you) share their screen, presenterChanged
Event on the Participant
is triggered with the participantId
of the screen share.
meeting.on(Events.presenterChanged, (_activePresenterId) {
Participant? activePresenterParticipant = meeting.participants[_activePresenterId];
Stream? _stream = activePresenterParticipant?
.streams.values
.singleWhere((e) => e.kind == "share");
remoteParticipantShareStream = _stream;
});
Got a Question? Ask us on discord