-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[camera_platform_interface] Adds support for video stabilization to camera_platform_interface #10337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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_platform_interface. It introduces a VideoStabilizationMode enum, along with methods getSupportedVideoStabilizationModes and setVideoStabilizationMode in CameraPlatform. A helper method getFallbackVideoStabilizationMode is also added to handle unsupported modes. The changes are accompanied by corresponding tests. My review includes suggestions to improve code consistency by removing unnecessary async keywords and to fix a typo in the test descriptions.
| /// Gets a list of video stabilization modes that are supported for the selected camera. | ||
| Future<Iterable<VideoStabilizationMode>> getSupportedVideoStabilizationModes( | ||
| int cameraId, | ||
| ) async => <VideoStabilizationMode>[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ) async { | ||
| throw UnimplementedError('setVideoStabilizationMode() is not implemented.'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async keyword is not necessary here since this method synchronously throws an error. You can remove it to be consistent with other unimplemented methods in this class, such as setZoomLevel.
| ) async { | |
| throw UnimplementedError('setVideoStabilizationMode() is not implemented.'); | |
| } | |
| ) { | |
| throw UnimplementedError('setVideoStabilizationMode() is not implemented.'); | |
| } |
| }, | ||
| ); | ||
|
|
||
| test('getFallbackViewStabilizationMode returns level2 for mode level3', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| expect(fallbackMode, VideoStabilizationMode.level2); | ||
| }); | ||
|
|
||
| test('getFallbackViewStabilizationMode returns level1 for mode level2', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| expect(fallbackMode, VideoStabilizationMode.level1); | ||
| }); | ||
|
|
||
| test('getFallbackViewStabilizationMode returns off for mode level1', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| expect(fallbackMode, VideoStabilizationMode.off); | ||
| }); | ||
|
|
||
| test('getFallbackViewStabilizationMode returns null for mode off', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
861f04d to
5e7c9c4
Compare
- Adds getSupportedVideoStabilizationModes() and setVideoStabilizationMode() methods to CameraPlatform. - Adds VideoStabilizationMode enum to represent an abstraction of the available video stabilization modes, meant for Android and iOS, mapped as follows: /// Video stabilization is disabled. off, /// Least stabilized video stabilization mode with the least latency. level1, /// More stabilized video with more latency. level2, /// Most stabilized video with the most latency. level3;
5e7c9c4 to
918f1c7
Compare
Adds support for video stabilization to camera_platform_interface.
Adds getSupportedVideoStabilizationModes() and setVideoStabilizationMode() methods to CameraPlatform.
Adds VideoStabilizationMode enum to represent an abstraction of the available video stabilization modes, meant for Android and iOS, mapped as follows:
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
Address issue flutter/flutter#89525.
It is the camera_platform_interface 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