startScreenCapture abstract method

Future<void> startScreenCapture(
  1. ScreenCaptureParameters2 captureParams
)

Starts screen capture.

This method is only applicable to Android and iOS platforms. Screen sharing stream billing is based on the dimensions value in ScreenVideoParameters : If not specified, billing is based on 1280 × 720. If specified, billing is based on the provided value. On iOS, screen sharing is only supported on iOS 12.0 and above. On iOS, if you use external audio capture instead of SDK audio capture, to prevent screen sharing from stopping when the app goes to the background, it is recommended to implement keep-alive logic. On iOS, this feature requires high device performance. It is recommended to use it on iPhone X or later. On iOS, this method depends on the screen sharing dynamic library AgoraReplayKitExtension.xcframework. Removing this library will cause screen sharing to fail. On Android, if the user does not grant screen capture permission to the app, the SDK reports the onPermissionError(2) callback. On Android 9 and above, to prevent the app from being killed when it goes to the background, add the foreground service permission android.permission.FOREGROUND_SERVICE in /app/Manifests/AndroidManifest.xml. Due to Android performance limitations, screen sharing is not supported on Android TV. Due to Android system limitations, avoid changing the screen sharing stream's video encoding resolution during sharing on Huawei devices to prevent crashes. Due to Android system limitations, some Xiaomi devices do not support capturing system audio during screen sharing. To improve the success rate of capturing system audio during screen sharing, it is recommended to call setAudioScenario and set the audio scenario to audioScenarioGameStreaming before joining the channel.

  • captureParams Encoding parameter configuration for screen sharing. See ScreenCaptureParameters2.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions.

Implementation

Future<void> startScreenCapture(ScreenCaptureParameters2 captureParams);