Rate this page:

ICameraManager

Interface that may be used to manage cameras on Android device.

Methods

addCameraEventsListener

Copy URL

void

addCameraEventsListener(

ICameraEventsListener

cameraEventsListener
)

Add ICameraEventsListener to be notified about camera events

Parameters

Returns

  • type:

    void

enableCameraFlash

Since ver. 2.18.0
Copy URL

void

enableCameraFlash(

boolean

enable
)

Enable or disable camera flash if it exists.

Camera flash is disabled by default.

Can be called in any camera state.

Parameters

  • enable:

    boolean

    True, if the camera flash should be enabled, false otherwise.

Returns

  • type:

    void

getCameraDeviceNames

Copy URL

String[]

getCameraDeviceNames()

Get available camera device names.

Returns

  • type:

    String[]

getCameraSupportedResolutions

Copy URL

List<CameraResolution>

getCameraSupportedResolutions(

String

cameraName
)

Get all supported resolutions of the specified camera.

Parameters

  • cameraName:

    String

    Camera name to request supported resolutions

Returns

removeCameraEventsListener

Copy URL

void

removeCameraEventsListener(

ICameraEventsListener

cameraEventsListener
)

Remove previously added ICameraEventsListener

Parameters

Returns

  • type:

    void

setCamera

Copy URL

void

setCamera(

int

cameraIndex,

VideoQuality

quality
)

Select a camera and the local video frame resolution quality.

Parameters

  • cameraIndex:

    int

    Should be 0 for back facing camera and 1 for front facing camera

  • quality:

    VideoQuality

    Quality for local video

Returns

  • type:

    void

setCamera

Since ver. 2.30.0
Copy URL

void

setCamera(

String

cameraName,

VideoQuality

quality
)

Select the camera and the local video frame resolution quality.

Limitation:

If a camera is open and is currently capturing the video, it is not possible to switch to another camera of the same type. If no camera is used in the moment, it is possible to select any camera and the selected camera will start in a video call.

For example, if a device has multiple back cameras and one of them is currently capturing the video in a call, it is not possible to switch to another back camera. The same is applied to the front facing cameras. However, it is allowed to change an active back camera to front camera with a specific name (ot vice verse).

Parameters

  • cameraName:

    String

    Camera name from the list of available cameras on the device

  • quality:

    VideoQuality

    Quality for local video

Returns

  • type:

    void

Throws

IllegalArgumentException if the camera with the specified name does not exist on the device

setCamera

Copy URL

void

setCamera(

int

cameraIndex,

int

frameWidth,

int

frameHeight
)

Select a camera and the local video frame resolution.

The camera will capture frames in a forma that is as close as possible to frameWidth x frameHeight

Parameters

  • cameraIndex:

    int

    Should be 0 for back facing camera or 1 for front facing camera

  • frameWidth:

    int

    Camera resolution width.

  • frameHeight:

    int

    Camera resolution height

Returns

  • type:

    void

setCamera

Since ver. 2.30.0
Copy URL

void

setCamera(

String

cameraName,

int

frameWidth,

int

frameHeight
)

Select the camera and the local video frame resolution.

Camera will capture frames in a format that is as close as possible to frameWidth x frameHeight

Limitation:

If a camera is open and is currently capturing the video, it is not possible to switch to another camera of the same type. If no camera is used in the moment, it is possible to select any camera and the selected camera will start in a video call.

For example, if a device has multiple back cameras and one of them is currently capturing the video in a call, it is not possible to switch to another back camera. The same is applied to the front facing cameras. However, it is allowed to change an active back camera to front camera with a specific name (ot vice verse).

Parameters

  • cameraName:

    String

    Camera name from the list of available cameras on the device

  • frameWidth:

    int

    Camera resolution width.

  • frameHeight:

    int

    Camera resolution height

Returns

  • type:

    void

Throws

IllegalArgumentException if the camera with the specified name does not exist on the device

useOrientationEventListener

Since ver. 2.26.0
Copy URL

void

useOrientationEventListener(

boolean

use
)

Use OrientationEventListener to detect the device rotation and to rotate camera frames according to device orientation.

By default, Display rotation is used to determine the device rotation.

The way how the device orientation is detected, affects camera frames rotation on local and remote side if auto-rotate is disabled on a mobile phone:

  • OrientationEventListener will detect landscape orientation
  • Display rotation will always report portrait orientation

The method should be called in idle camera state, i.e. video is currently not sending in a call.

Parameters

  • use:

    boolean

    True, if OrientationEventListener should be used to detect the device orientation, otherwise Display rotation is used.

Returns

  • type:

    void