Skip to content

Advanced Camera APIs

Bharath Balan edited this page Jan 27, 2022 · 1 revision

Why do we need Camera API?

These APIs let the user play around with the system camera of the device. Users can manipulate the exposure values, set zoom factor, use the camera flash, and much more.

NOTE: This API is available from SDK version 3.3.0-BETA onwards

Camera APIs

  1. var cameraTorchMode: TorchMode

This API lets the user enable, disable or auto-enable the camera torch of the phone. This API only works with the rear camera of the device.

  1. var cameraFlashMode: FlashMode

This API lets the user enable, disable or auto-enable the camera flash of the phone and will be triggered at the time of takePhoto() API.

  1. var zoomFactor: Float

This lets the user zoom in or out depending upon the device's capability.

  1. var exposureDuration: CameraExposureDuration

This API will give the min, max range as well as the current value of the camera exposure duration. The default value until it is set is 0.

  1. var exposureISO: CameraExposureISO

This API will give the min, max range as well as the current value of the camera exposure ISO. The default value until it is set is 0.

  1. var exposureTargetBias: CameraExposureTargetBias

This API will give the min, max range as well as the current value of the camera target bias. The default value until it is set is 0.

  1. func setCameraFocusAtPoint(pointX: Float, pointY: Float) -> Bool

This API lets the user to focus the camera at a particular point.

  1. func setCameraCustomExposure(duration: UInt64, iso: Float) -> Bool

This API takes in exposure duration and exposure ISO value to custom adjust the exposure. Exposure duration determines the amount of time your film is exposed to light when taking a photograph. ISO is your camera's sensitivity to light as it pertains to either film or a digital sensor. A lower ISO value means less sensitivity to light, while a higher ISO means more sensitivity.

  1. func setCameraAutoExposure(targetBias: Float) -> Bool

This API takes in Target bias to auto-adjust the exposure. Target bias is set to make a scene brighter, move the camera, and exposure will keep adjusting to keep that level of enhanced brightness.

  1. func takePhoto() -> Bool

This API lets you click a photo of the local view. The result is obtained as Data in Call.onPhotoCaptured: ((_ imageData: Data?) -> Void)?


Steps to use Camera API

  1. First the user needs to be on a call, whether 1-1 or a meeting.
  2. The user needs to enable the local camera view to use camera APIs.
  3. Call the desired camera API.