ICameraManager
Interface that provides API to manage cameras on an Android device.
Methods
addCameraEventsListener
addCameraEventsListener(cameraEventsListener: ): void
Adds an ICameraEventsListener to be notified about camera events
Parameters
cameraEventsListener:
ICameraEventsListener instance
Returns
type:
void
enableCameraFlash
enableCameraFlash(enable: boolean
): void
Whether to enable 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.
Returns
type:
void
getCameraDeviceNames
getCameraDeviceNames(): String[]
Gets available camera device names.
Returns
type:
String[]
getCameraSupportedResolutions
getCameraSupportedResolutions(cameraName: String
): List<CameraResolution>
Gets all supported resolutions of the specified camera.
Parameters
cameraName:
String
Camera name to request supported resolutions
Returns
type:
List<CameraResolution>
removeCameraEventsListener
removeCameraEventsListener(cameraEventsListener: ): void
Removes a previously added ICameraEventsListener
Parameters
cameraEventsListener:
ICameraEventsListener instance
Returns
type:
void
setCamera
setCamera(cameraIndex: int
, quality: ): void
Selects a camera and the local video frame resolution quality.
Parameters
cameraIndex:
int
Should be 0 for a back facing camera and 1 for a front facing camera
quality:
Quality for local video
Returns
type:
void
Throws
IllegalArgumentException if a camera with the specified index does not exist on the device
setCamera
setCamera(cameraName: String
, quality: ): void
Selects a camera and the local video frame resolution quality.
Limitation for SDK versions below 2.41.0:
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 at the moment, it is possible to select any camera and the selected camera starts 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 a front facing cameras. However, it is allowed to change an active back camera to front camera with a specific name (or vice verse).
Parameters
cameraName:
String
Camera name from the list of available cameras on a device
quality:
Quality for local video
Returns
type:
void
Throws
IllegalArgumentException if a camera with the specified name does not exist on a device
setCamera
setCamera(cameraIndex: int
, frameWidth: int
, frameHeight: int
): void
Selects a camera and the local video frame resolution.
The camera captures frames in a format that is as close as possible to frameWidth x frameHeight
Parameters
cameraIndex:
int
Should be 0 for a back facing camera or 1 for a front facing camera
frameWidth:
int
Camera resolution width.
frameHeight:
int
Camera resolution height
Returns
type:
void
Throws
IllegalArgumentException if a camera with the specified index does not exist on the device
setCamera
setCamera(cameraName: String
, frameWidth: int
, frameHeight: int
): void
Selects a camera and the local video frame resolution.
Camera captures frames in a format that is as close as possible to frameWidth x frameHeight
Limitation for SDK versions below 2.41.0:
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 at the moment, it is possible to select any camera and the selected camera starts 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 a front facing cameras. However, it is allowed to change an active back camera to front camera with a specific name (or vice verse).
Parameters
cameraName:
String
Camera name from the list of available cameras on a device
frameWidth:
int
Camera resolution width
frameHeight:
int
Camera resolution height
Returns
type:
void
Throws
IllegalArgumentException if a camera with the specified name does not exist on a device
useOrientationEventListener
useOrientationEventListener(use: boolean
): void
Enables 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 detects landscape orientation
- Display rotation always reports 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