-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camera_web] Fixed crashing bug on camera_web 0.3.5 for Safari #10595
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
Conversation
|
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. |
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 effectively resolves a crashing bug in camera_web on Safari by safely handling cases where the facingMode capability is not supported. The fix involves using a nullable getter and null-safe operators, which is the correct approach. The addition of a new integration test to cover this specific scenario is excellent and ensures this regression won't happen again. The changelog and version updates are also correctly handled. I have one suggestion to further improve the test coverage for the related code path.
packages/camera/camera_web/example/integration_test/camera_service_test.dart
Show resolved
Hide resolved
…n-nullable field on browsers without facingMode available
6c617c6 to
e62691b
Compare
…tings on top of FakeMediaTrackCapabilities
e62691b to
53406ea
Compare
mdebbar
left a comment
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.
Thanks for the fix!
stuartmorgan-g
left a comment
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.
LGTM
flutter/packages@9705815...039a026 2026-01-07 [email protected] Manual roll Flutter (stable) from 66dd93f to f6ff152 (2 revisions) (flutter/packages#10746) 2026-01-07 [email protected] [ci] release action uses sub action for installing flutter (flutter/packages#10747) 2026-01-07 [email protected] Fix html in webview_flutter doc comment (flutter/packages#10634) 2026-01-07 [email protected] [camera_web] Fixed crashing bug on camera_web 0.3.5 for Safari (flutter/packages#10595) 2026-01-07 [email protected] Roll Flutter from 13b2b91 to 01d37bc (74 revisions) (flutter/packages#10745) 2026-01-07 [email protected] [ci] adjust github action, need to checkout repo before using local action (flutter/packages#10744) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
On certain browsers (Safari), getting
facingModeon video track capabilities is not supported. The code first checks iffacingModeis available onMediaTrackSettingsusingfacingModeNullablebut when the code checks for facingMode onMediaTrackCapabilities, it uses the non nullablefacingModegetter instead offacingModeNullable. This causes a crash and the camera isn't initialized correctly.This is a blocker for reliably deploying camera_web 0.3.5 which enables people to use WASM with camera functionality.
Fixes flutter/flutter#155210
Testing
Tested on Safari on Mac and iPhone with camera initialization - camera now successfully initializes where it previously failed.
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