startScreenCapture abstract method

Future<void> startScreenCapture(
  1. ScreenCaptureParameters2 captureParams
)

Starts screen capture.

There are two options for enabling screen sharing. You can choose the one that best suits your specific scenario: Call this method before joining a channel, then call joinChannel to join channel and set publishScreenCaptureVideo to true to start screen sharing. Call this method after joining a channel, then call updateChannelMediaOptions and set publishScreenCaptureVideo to true to start screen sharing. This method applies to Android and iOS only. On the iOS platform, screen sharing is only available on iOS 12.0 and later. The billing for the screen sharing stream is based on the dimensions in ScreenVideoParameters. When you do not pass in a value, Agora bills you at 1280 × 720; when you pass a value in, Agora bills you at that value. For billing details, see. If you are using the custom audio source instead of the SDK to capture audio, Agora recommends you add the keep-alive processing logic to your application to avoid screen sharing stopping when the application goes to the background. This feature requires high-performance device, and Agora recommends that you use it on iPhone X and later models. This method relies on the iOS screen sharing dynamic library AgoraReplayKitExtension.xcframework. If the dynamic library is deleted, screen sharing cannot be enabled normally. On the Android platform, if the user has not granted the app screen capture permission, the SDK reports the onPermissionError (2) callback. On Android 9 and later, to avoid the application being killed by the system after going to the background, Agora recommends you add the foreground service android.permission.FOREGROUND_SERVICE to the /app/Manifests/AndroidManifest.xml file. Due to performance limitations, screen sharing is not supported on Android TV. Due to system limitations, if you are using Huawei phones, do not adjust the video encoding resolution of the screen sharing stream during the screen sharing, or you could experience crashes. Due to system limitations, some Xiaomi devices do not support capturing system audio during screen sharing. To avoid system audio capture failure when screen sharing, Agora recommends that you set the audio application scenario to audioScenarioGameStreaming by using the setAudioScenario method before joining the channel.

  • captureParams The screen sharing encoding parameters. The default video dimension is 1920 x 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. 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.

Implementation

Future<void> startScreenCapture(ScreenCaptureParameters2 captureParams);