enableScreenShare method
Enables screen sharing for the local participant.
-
When screen sharing is successfully started, a Events.streamEnabled event is emitted with the corresponding screen-share Stream object in the event handler, inside the associated Participant object.
-
Additionally, a Events.presenterChanged event is emitted with the
presenterIdof the participant who started presenting.
Parameters
-
enableAudio(optional): Specifies whether system audio should be shared along with the screen, if supported by the platform. -
source(optional): ADesktopCapturerSourcerepresenting the selected screen or application window to share. This parameter is applicable only for desktop platforms. If not provided, the default screen source will be used.
Events associated with enableScreenShare()
- Events.streamEnabled with the screen-share Stream
- Events.presenterChanged with the
presenterId
Example
// Enable screen sharing with default screen
await meeting.enableScreenShare();
// Enable screen sharing with a selected source (desktop)
final sources = await meeting.getScreenShareSources();
await meeting.enableScreenShare(source: sources.first);
meeting.on(Events.presenterChanged, (event) {
print('Presenter changed: ${event.presenterId}');
});
Implementation
Future<void> enableScreenShare({
bool? enableAudio,
DesktopCapturerSource? source,
}) =>
_enableScreenShare(enableAudio: enableAudio, source: source);