startShareScreen

Starts the screen sharing process.

This function initiates screen sharing by requesting screen capture permissions and setting up the necessary WebRTC components. It handles platform-specific considerations and provides appropriate feedback to the user.

Features:

  • Screen capture permission handling

  • Platform-specific screen sharing setup

  • WebRTC screen stream creation

  • Error handling and user feedback

  • Success callback triggering

Parameters:

  • options Configuration options for starting screen sharing

Returns:

Android Usage:

// In your Activity, use ScreenCaptureHelper to get permission:
val screenCaptureHelper = ScreenCaptureHelper.create(activity)
val permissionData = screenCaptureHelper.requestPermission()

val options = StartShareScreenOptions(
parameters = myParameters,
targetWidth = 1920,
targetHeight = 1080,
mediaProjectionData = mapOf(
"resultCode" to permissionData.resultCode,
"data" to permissionData.data
)
)

val result = startShareScreen(options)
result.onSuccess {
}
result.onFailure { error ->
Logger.e("StartShareScreen", "Error starting screen sharing: ${error.message}")
}