startScreenCaptureByDisplayId
Captures the screen by specifying the display ID.
Details
This method shares a screen or part of the screen.
There are two ways to start screen sharing, you can choose one according to your needs:
- Call this method before joining a channel, and then call joinChannel [2/2] to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing. - Call this method after joining a channel, and then call updateChannelMediaOptions and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing.
Parameters
- displayId
- The display ID of the screen to be shared.
- captureParams
- Screen sharing configurations. 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 .
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling stopScreenCapture to stop the current sharing and start sharing the screen again.