Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
VideoQuality quality = VideoQuality.high,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new quality parameter is not being used. It needs to be passed down to the native implementation.

This will require:

  1. Passing quality to _getVideoPath.
  2. Updating _getVideoPath to accept quality and pass it to the method channel invocation for pickVideo.

}) async {
final String? path = await _getVideoPath(
source: source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.
/// Defaults to [CameraDevice.rear].
///
/// The [quality] argument specifies the video quality for recording/picking. Defaults to [VideoQuality.high].
///
/// In Android, the MainActivity can be destroyed for various reasons. If that happens, the result will be lost
/// in this call. You can then call [getLostData] when your app relaunches to retrieve the lost data.
///
Expand All @@ -249,6 +251,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
VideoQuality quality = VideoQuality.high,
}) {
throw UnimplementedError('getVideo() has not been implemented.');
}
Expand Down Expand Up @@ -390,6 +393,7 @@ abstract class CameraDelegatingImagePickerPlatform extends ImagePickerPlatform {
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
VideoQuality quality = VideoQuality.high,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new quality parameter is not used when source is ImageSource.camera. It should be passed to the camera delegate.

This will require:

  1. Adding a videoQuality property to ImagePickerCameraDelegateOptions.
  2. Passing the quality to ImagePickerCameraDelegateOptions when calling delegate.takeVideo.

}) async {
if (source == ImageSource.camera) {
final ImagePickerCameraDelegate? delegate = cameraDelegate;
Expand All @@ -410,6 +414,7 @@ abstract class CameraDelegatingImagePickerPlatform extends ImagePickerPlatform {
source: source,
preferredCameraDevice: preferredCameraDevice,
maxDuration: maxDuration,
quality: quality,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export 'multi_image_picker_options.dart';
export 'multi_video_picker_options.dart';
export 'picked_file/picked_file.dart';
export 'retrieve_type.dart';
export 'video_quality.dart';

/// Denotes that an image is being picked.
const String kTypeImage = 'image';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Video quality setting for video recording/picking.
///
/// This enum corresponds to `UIImagePickerControllerQualityType` on iOS.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It would be helpful to also document the correspondence on Android. On Android, this will likely correspond to MediaStore.EXTRA_VIDEO_QUALITY, which only supports high (1) and low (0) quality. Please clarify how medium will be handled on Android.

enum VideoQuality {
/// Low quality video.
///
/// Corresponds to `UIImagePickerControllerQualityTypeLow` on iOS.
low,

/// Medium quality video.
///
/// Corresponds to `UIImagePickerControllerQualityTypeMedium` on iOS.
medium,

/// High quality video.
///
/// Corresponds to `UIImagePickerControllerQualityTypeHigh` on iOS.
/// This is the default quality setting.
high,
}