getSupportedVideoSizes method

Future<List<CameraSize>?> getSupportedVideoSizes()

Gets the supported video frame sizes that can be used by MediaRecorder.

If the returned list is not null, the returned list will contain at least one Size and one of the sizes in the returned list must be passed to MediaRecorder.setVideoSize for camcorder application if camera is used as the video source. In this case, the size of the preview can be different from the resolution of the recorded video during video recording.

Exception on 176x144 (QCIF) resolution: Camera devices usually have a fixed capability for downscaling from larger resolution to smaller, and the QCIF resolution sometimes is not fully supported due to this limitation on devices with high-resolution image sensors. Therefore, trying to configure a QCIF video resolution with any preview or picture size larger than 1920x1080 (either width or height) might not be supported, and Camera.setParameters will throw a RuntimeException if it is not.

Returns a list of CameraSize object if camera has separate preview and video output; otherwise, null is returned.

See: getPreferredPreviewSizeForVideo

Implementation

Future<List<CameraSize>?> getSupportedVideoSizes() async {
  final List<Object?>? sizes =
      await _channel.$getSupportedVideoSizes(this) as List<Object?>?;
  return sizes?.cast<CameraSize>();
}