Skip to navigation

CameraVideoSource (object)

Android SDK v3 API reference
View as Markdown

video

Class that represents a video source that captures frames from the device’s camera.

Requires VICalls.initialize and the CAMERA permission. Use VICalls.getMissingPermissions to check required permissions before starting video.

Use selectCameraDevice and setPreferredResolution to configure the camera before or during a call. Subscribe to capture lifecycle events via VideoSource.addListener.

Inherits from VideoSource.

Methods

selectCameraDevice

fun selectCameraDevice(cameraDevice: CameraDevice): Unit

Switches capture to the specified camera device.

Updates CameraVideoSource.currentCameraDevice. If capture is not running, the device gets selected and activated when capture starts.

Parameters

ParameterTypeRequirementDescription
cameraDeviceCameraDeviceCamera device from CameraVideoSource.cameraDevices to select

Returns: Unit

setPreferredResolution

fun setPreferredResolution(resolution: CameraResolution): Unit

Sets the preferred capture resolution for all camera devices.

Updates preferredResolution. The closest supported resolution from each device’s CameraDevice.supportedResolutions is selected. If capture is already running, the new resolution is applied to currentCameraDevice.

Parameters

ParameterTypeRequirementDescription
resolutionCameraResolutionPreferred camera resolution for camera capture

Returns: Unit

Properties

cameraDevices

var cameraDevices: List<CameraDevice>

List of available camera devices on the Android device.

Pass an element from this list to selectCameraDevice to switch cameras.

cameraOrientation

var cameraOrientation: CameraOrientation

Orientation mode used when capturing video frames.

CameraOrientation.Screen follows the screen orientation. CameraOrientation.Device follows the device orientation.

The default value is CameraOrientation.Screen.

currentCameraDevice

var currentCameraDevice: CameraDevice?

Camera device used for capture.

Active device while capture is running, or the device used when capture starts. Change it via selectCameraDevice.

Device-specific options such as CameraDevice.flash can be configured on this CameraDevice.

preferredResolution

var preferredResolution: CameraResolution

Preferred camera resolution.

The closest supported resolution from CameraResolution is selected for each CameraDevice in CameraVideoSource.cameraDevices. You can change this value via CameraVideoSource.setPreferredResolution.

The default value is CameraResolution.Medium (640x480).