createScreenShareTrack static method

Future<LocalVideoTrack> createScreenShareTrack(
  1. [ScreenShareCaptureOptions? options]
)

Creates a LocalVideoTrack from the display.

Note: Android requires a foreground service to be started prior to creating a screen track. Refer to the example app for an implementation.

Implementation

static Future<LocalVideoTrack> createScreenShareTrack([
  ScreenShareCaptureOptions? options,
]) async {
  options ??= const ScreenShareCaptureOptions();

  final stream = await LocalTrack.createStream(options);
  return LocalVideoTrack._(
    TrackSource.screenShareVideo,
    stream,
    stream.getVideoTracks().first,
    options,
  );
}