Skip to content

Conversation

@jalen-videotape
Copy link

On certain browsers (Safari), getting facingMode on video track capabilities is not supported. The code first checks if facingMode is available on MediaTrackSettings using facingModeNullable but when the code checks for facingMode on MediaTrackCapabilities, it uses the non nullable facingMode getter instead of facingModeNullable. 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

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

@google-cla
Copy link

google-cla bot commented Dec 10, 2025

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.

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 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.

@jalen-videotape jalen-videotape force-pushed the main branch 3 times, most recently from 6c617c6 to e62691b Compare December 10, 2025 02:39
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.

Camera Web example doesn't work on Safari

1 participant