enableScreenShare method

Future<void> enableScreenShare({
  1. bool? enableAudio,
  2. DesktopCapturerSource? source,
})

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 presenterId of 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): A DesktopCapturerSource representing 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()

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);