capture Image
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.
Before the meeting is joined, or while it is reconnecting, no capture is attempted: onError receives the reason, and onError fires with code 3001 (ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED) or 3014 (ERROR_MEETING_RECONNECTING).
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
(Optional) The desired image height in pixels.
(Optional) The desired image width in pixels.
the TaskCompletionListener to receive the Base64 image or error
Throws
if called on a remote participant or the webcam is not enabled