Skip to content

[image_picker] Add videoQuality parameter to pickVideo#11200

Draft
Koichi5 wants to merge 6 commits intoflutter:mainfrom
Koichi5:feat/image_picker_video_quality
Draft

[image_picker] Add videoQuality parameter to pickVideo#11200
Koichi5 wants to merge 6 commits intoflutter:mainfrom
Koichi5:feat/image_picker_video_quality

Conversation

@Koichi5
Copy link

@Koichi5 Koichi5 commented Mar 8, 2026

Description

Adds a videoQuality parameter to pickVideo across the image_picker federation, allowing apps to specify video recording quality (low, medium, high).

This is a combination PR for the following individual changes:

Addresses flutter/flutter#179940

Changes

Package Version Change
image_picker_platform_interface 2.11.1 → 2.12.0 VideoQuality enum, getVideo videoQuality param
image_picker_android 0.8.13+14 → 0.8.14 Maps quality to CamcorderProfile
image_picker_ios 0.8.13+6 → 0.8.14 Maps quality to UIImagePickerControllerQualityType
image_picker_macos 0.2.2+1 → 0.2.3 Pass-through support
image_picker_linux 0.2.2 → 0.2.3 Pass-through support
image_picker_windows 0.2.2 → 0.2.3 Pass-through support
image_picker_for_web 3.1.1 → 3.1.2 Pass-through support
image_picker 1.2.1 → 1.3.0 pickVideo videoQuality parameter

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under[^1].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

Koichi5 and others added 6 commits March 8, 2026 17:00
Adds VideoQuality enum and an optional quality parameter to getVideo
in the platform interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Version bumps:
- image_picker_platform_interface: 2.11.1 -> 2.12.0
- image_picker_android: 0.8.13+14 -> 0.8.14
- image_picker_ios: 0.8.13+6 -> 0.8.14
- image_picker_macos: 0.2.2+1 -> 0.2.3
- image_picker_linux: 0.2.2 -> 0.2.3
- image_picker_windows: 0.2.2 -> 0.2.3
- image_picker_for_web: 3.1.1 -> 3.1.2
- image_picker: 1.2.1 -> 1.3.0
FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
@google-cla
Copy link

google-cla bot commented Mar 8, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a videoQuality parameter to pickVideo across the image_picker federated plugin, allowing users to specify video recording quality. The changes span the platform interface, Android, iOS, and other platform implementations, as well as the example app. My review focuses on a few areas for improvement. There's some code duplication in the example app that could be refactored. The iOS implementation is missing tests for the new video quality feature. More critically, the videoQuality parameter is not correctly passed down to the camera delegate in the platform interface, and it's completely unused in the fallback method channel implementation, which are significant oversights.

Comment on lines 393 to 397
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
VideoQuality quality = VideoQuality.high,
}) async {

Choose a reason for hiding this comment

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

critical

The quality parameter is not passed to the cameraDelegate when source is ImageSource.camera. This means the video quality setting will be ignored for platforms that use a camera delegate (e.g., Linux, macOS, Windows).

To fix this, ImagePickerCameraDelegateOptions should be updated to include the video quality, and takeVideo in ImagePickerCameraDelegate should be updated to accept it. Then you can pass it here:

return delegate.takeVideo(
  options: ImagePickerCameraDelegateOptions(
    preferredCameraDevice: preferredCameraDevice,
    maxVideoDuration: maxDuration,
    videoQuality: quality, // Add this
  ),
);

Comment on lines +490 to 525
if (_picker.supportsImageSource(ImageSource.camera))
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: FloatingActionButton(
backgroundColor: Colors.orange,
onPressed: () {
isVideo = true;
_onImageButtonPressed(
ImageSource.camera,
context: context,
videoQuality: VideoQuality.medium,
);
},
heroTag: 'takeVideoMedium',
tooltip: 'Take a video (medium quality)',
child: const Icon(Icons.videocam),
),
),
if (_picker.supportsImageSource(ImageSource.camera))
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: FloatingActionButton(
backgroundColor: Colors.blue,
onPressed: () {
isVideo = true;
_onImageButtonPressed(
ImageSource.camera,
context: context,
videoQuality: VideoQuality.low,
);
},
heroTag: 'takeVideoLow',
tooltip: 'Take a video (low quality)',
child: const Icon(Icons.videocam),
),
),

Choose a reason for hiding this comment

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

medium

There's significant code duplication for creating the FloatingActionButtons for different video qualities. This can be refactored into a helper method to improve maintainability and readability.

For example, you could create a helper widget/method like this:

Widget _buildVideoButton({
  required VideoQuality quality,
  required Color color,
  required String heroTag,
  required String tooltip,
}) {
  return Padding(
    padding: const EdgeInsets.only(top: 16.0),
    child: FloatingActionButton(
      backgroundColor: color,
      onPressed: () {
        isVideo = true;
        _onImageButtonPressed(
          ImageSource.camera,
          context: context,
          videoQuality: quality,
        );
      },
      heroTag: heroTag,
      tooltip: tooltip,
      child: const Icon(Icons.videocam),
    ),
  );
}

And then use it for all three buttons.

Comment on lines 940 to 944
Future<String?> pickVideo(
SourceSpecification source,
int? maxDurationSeconds,
ApiVideoQuality? videoQuality,
) async {

Choose a reason for hiding this comment

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

medium

While the fake API has been updated to accept videoQuality, there are no corresponding tests to verify that this parameter is correctly passed to the native side. The Android implementation includes such tests, and it would be good to have them here for consistency and to ensure the feature works as expected on iOS.

Please consider adding tests for:

  • The default quality when quality is not provided.
  • Passing each of the VideoQuality enum values.

@stuartmorgan-g
Copy link
Collaborator

Thanks for the contribution! We won't be able to review this PR until the CLA check is passing. If you are the author of all of the code in the PR, per the CLA requirements, the commit authorship will need to reflect that.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft March 9, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants