Skip to content

[camera_android_camerax] Adds support for video stabilization#11020

Open
ruicraveiro wants to merge 1 commit intoflutter:mainfrom
ruicraveiro:camera_android_video_stabilization
Open

[camera_android_camerax] Adds support for video stabilization#11020
ruicraveiro wants to merge 1 commit intoflutter:mainfrom
ruicraveiro:camera_android_video_stabilization

Conversation

@ruicraveiro
Copy link
Contributor

Implements getSupportedVideoStabilizationModes() and setVideoStabilizationMode() methods in AndroidCameraCameraX.

Address issue flutter/flutter#89525.
It is the camera_android_camerax sub-PR for #7108.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

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 support for video stabilization to the camera_android_camerax plugin. It introduces getSupportedVideoStabilizationModes() and setVideoStabilizationMode() methods. The implementation leverages CameraX's CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES and CONTROL_VIDEO_STABILIZATION_MODE characteristics. The supported modes are currently mapped to off and level1 (for ON). The changes include updates to Pigeon definitions, native Java/Kotlin code, Dart implementation, and tests to verify the new functionality.

Comment on lines 944 to 948
final List<int> controlModes =
(await camera2CameraInfo.getCameraCharacteristic(
CameraCharacteristics.controlAvailableVideoStabilizationModes,
))!
as List<int>;

Choose a reason for hiding this comment

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

high

The force unwrap operator (!) on the result of getCameraCharacteristic could lead to a runtime crash if the characteristic is not available on the device and the method returns null. It's safer to handle the potential null value, for example by defaulting to an empty list.

Suggested change
final List<int> controlModes =
(await camera2CameraInfo.getCameraCharacteristic(
CameraCharacteristics.controlAvailableVideoStabilizationModes,
))!
as List<int>;
final List<int> controlModes =
await camera2CameraInfo.getCameraCharacteristic(
CameraCharacteristics.controlAvailableVideoStabilizationModes,
) as List<int>? ??
const <int>[];

@ruicraveiro ruicraveiro force-pushed the camera_android_video_stabilization branch from 7a1fb9e to 2acd59c Compare February 14, 2026 11:58
- Implements getSupportedVideoStabilizationModes() and
  setVideoStabilizationMode() methods in AndroidCameraCameraX.
@ruicraveiro ruicraveiro force-pushed the camera_android_video_stabilization branch from 2acd59c to 86b3804 Compare February 14, 2026 12:01
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.

1 participant