- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.5k
 
[camera_web] Fix camera initialization failure on Firefox Android #10341
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
When VideoConstraints has no constraints, return true.toJS instead of an
empty object. Firefox Android rejects getUserMedia({video: {}}) with an
AbortError, but accepts {video: true}.
This fixes the camera initialization failure in availableCameras() on
Firefox Android while maintaining compatibility with other browsers.
Fixes flutter/flutter#XXXXX
    When VideoConstraints has no constraints, return true.toJS instead of an
empty object. Firefox Android rejects getUserMedia({video: {}}) with an
AbortError, but accepts {video: true}.
This fixes the camera initialization failure in availableCameras() on
Firefox Android while maintaining compatibility with other browsers.
Fixes flutter/flutter#XXXXX
    …omeo4934/packages into fix-camera-web-firefox-android # Conflicts: # packages/camera/camera_web/lib/src/types/camera_options.dart
| 
           It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.  | 
    
| 
           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 fixes a camera initialization failure on Firefox for Android. The change modifies VideoConstraints.toMediaStreamConstraints() to return true instead of an empty object when no video constraints are specified, improving browser compatibility. The changelog and package version are updated accordingly. My review focuses on the lack of a test case for this new logic path, which is required by the project's contribution guidelines.
Add integration test to verify that VideoConstraints.toMediaStreamConstraints() returns true when no constraints are provided, covering the Firefox Android compatibility fix.
a92f2bd    to
    ecf097d      
    Compare
  
    
Description
Fixes camera initialization failure on Firefox Android when no video constraints are specified.
Firefox Android rejects
getUserMedia({video: {}})with anAbortError, but accepts{video: true}. This PR modifiesVideoConstraints.toMediaStreamConstraints()to returntrue.toJSinstead of an empty object when no constraints are specified, improving browser compatibility.Related Issue
This fix addresses camera initialization failures on Firefox Android where the camera plugin would fail with a
CameraException(cameraAbort)error.Testing
Tested on Firefox Android with camera initialization - camera now successfully initializes where it previously failed.
Checklist
///)flutter analyze) does not report any problems on my PRBreaking Change
Generated with Claude Code