[camera_android_camerax] Adds support for video stabilization#11020
[camera_android_camerax] Adds support for video stabilization#11020ruicraveiro wants to merge 1 commit intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
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.
| final List<int> controlModes = | ||
| (await camera2CameraInfo.getCameraCharacteristic( | ||
| CameraCharacteristics.controlAvailableVideoStabilizationModes, | ||
| ))! | ||
| as List<int>; |
There was a problem hiding this comment.
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.
| 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>[]; |
7a1fb9e to
2acd59c
Compare
- Implements getSupportedVideoStabilizationModes() and setVideoStabilizationMode() methods in AndroidCameraCameraX.
2acd59c to
86b3804
Compare
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
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).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-assistbot 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
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