amazon-chime-sdk / com.amazonaws.services.chime.sdk.meetings.audiovideo.video.capture / DefaultScreenCaptureSource / <init>

<init>

DefaultScreenCaptureSource(context: Context, logger: Logger, surfaceTextureCaptureSourceFactory: SurfaceTextureCaptureSourceFactory, activityResultCode: Int, activityData: Intent, displayManager: DisplayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager, mediaProjectionManager: MediaProjectionManager = context.getSystemService(MEDIA_PROJECTION_SERVICE) as MediaProjectionManager)

DefaultScreenCaptureSource uses MediaProjection to create a VirtualDisplay to capture the device screen. It will render the captured frames to a Surface provided by a SurfaceTextureCaptureSourceFactory.

Builders will need to get permission from users to obtain the activityResultCode and activityData arguments, required to create an internal MediaProjection object. Read content share guide for more information.

Note that you must finish starting the foreground service before calling start. Otherwise start will fail to succeed despite having the user grant permission and despite having created a foreground service for the MediaProjection. CaptureSourceObserver.onCaptureFailed will be called with CaptureSourceError.SystemFailure in this case.

If the MediaProjection could not be obtained with the activityResultCode and activityData, CaptureSourceObserver.onCaptureFailed will be called with CaptureSourceError.ConfigurationFailure.