VideoCapabilities


interface VideoCapabilities


VideoCapabilities is used to query video recording capabilities on the device.

Take Recorder as an example, the supported DynamicRanges can be queried with the following code:

  VideoCapabilities videoCapabilities = Recorder.getVideoCapabilities(cameraInfo);
  Set<DynamicRange> supportedDynamicRanges = videoCapabilities.getSupportedDynamicRanges();

The query result can be used to check if high dynamic range (HDR) recording is supported, and to get the supported qualities of the target DynamicRange:

  List<Quality> supportedQualities = videoCapabilities.getSupportedQualities(dynamicRange);

Summary

Public functions

(Mutable)Set<DynamicRange!>

Gets all dynamic ranges supported by both the camera and video output.

(Mutable)List<Quality!>

Gets all supported qualities for the input dynamic range.

Boolean
isQualitySupported(quality: Quality, dynamicRange: DynamicRange)

Checks if the quality is supported for the input dynamic range.

Boolean

Returns if video stabilization is supported on the device.

Public functions

getSupportedDynamicRanges

Added in 1.3.0
fun getSupportedDynamicRanges(): (Mutable)Set<DynamicRange!>

Gets all dynamic ranges supported by both the camera and video output.

Only DynamicRanges with specified values both in DynamicRange.BitDepth and DynamicRange.DynamicRangeEncoding will be present in the returned set. DynamicRanges such as HDR_UNSPECIFIED_10_BIT will not be included, but they can be used in other methods, such as checking for quality support with isQualitySupported.

Returns
(Mutable)Set<DynamicRange!>

a set of supported dynamic ranges.

getSupportedQualities

Added in 1.3.0
fun getSupportedQualities(dynamicRange: DynamicRange): (Mutable)List<Quality!>

Gets all supported qualities for the input dynamic range.

The returned list is sorted by quality size from largest to smallest. For the qualities in the returned list, with the same input dynamicRange, isQualitySupported will return true.

When the dynamicRange is not fully specified, e.g. HDR_UNSPECIFIED_10_BIT, the returned list is the union of the qualities supported by the matching fully specified dynamic ranges. This does not mean that all returned qualities are available for every matching dynamic range. Therefore, it is not recommended to rely on any one particular quality to work if mixing use cases with other dynamic ranges.

Note: Constants HIGHEST and LOWEST are not included in the returned list, but their corresponding qualities are included. For example: when the returned list consists of UHD, FHD and HD, HIGHEST corresponds to UHD, which is the highest quality, and LOWEST corresponds to HD.

Parameters
dynamicRange: DynamicRange

the dynamicRange.

Returns
(Mutable)List<Quality!>

a list of supported qualities sorted by size from large to small.

isQualitySupported

Added in 1.3.0
fun isQualitySupported(quality: Quality, dynamicRange: DynamicRange): Boolean

Checks if the quality is supported for the input dynamic range.

Calling this method with one of the qualities contained in the returned list of getSupportedQualities will return true.

Possible values for quality include LOWEST, HIGHEST, SD, HD, FHD and UHD.

If this method is called with LOWEST or HIGHEST, it will return true except the case that none of the qualities can be supported.

When the dynamicRange is not fully specified, e.g. HDR_UNSPECIFIED_10_BIT, true will be returned if there is any matching fully specified dynamic range supporting the quality, otherwise false will be returned.

Parameters
quality: Quality

one of the quality constants.

dynamicRange: DynamicRange

the dynamicRange.

Returns
Boolean

true if the quality is supported; false otherwise.

isStabilizationSupported

Added in 1.4.0
fun isStabilizationSupported(): Boolean

Returns if video stabilization is supported on the device. Video stabilization can be turned on via setVideoStabilizationEnabled.

Not all recording sizes or frame rates may be supported for stabilization by a device that reports stabilization support. It is guaranteed that an output targeting a MediaRecorder or MediaCodec will be stabilized if the recording resolution is less than or equal to 1920 x 1080 (width less than or equal to 1920, height less than or equal to 1080), and the recording frame rate is less than or equal to 30fps. At other sizes, the video stabilization will not take effect.

Returns
Boolean

true if CONTROL_VIDEO_STABILIZATION_MODE_ON is supported, otherwise false.