captureImage

fun captureImage(height: Int, width: Int, listener: TaskCompletionListener<String, String>)

This method can be used to capture a snapshot image from the local participant's webcam.

The captured image is returned as a Base64-encoded string via the TaskCompletionListener callback.

Note: This method can only be called on the local participant and requires the webcam to be enabled. Calling it on a remote participant or with the webcam disabled will throw an Error.

Code Example:


localParticipant.captureImage(
    720,  // height in pixels
    1280, // width in pixels
    object : TaskCompletionListener<String, String> {
        override fun onComplete(base64Image: String) {
            // Use the captured image
        }

        override fun onError(error: String) {
            // Handle error
        }
    }
)

Parameters

height

(Optional) The desired image height in pixels.

width

(Optional) The desired image width in pixels.

listener

the TaskCompletionListener to receive the Base64 image or error

Throws

if called on a remote participant or the webcam is not enabled