Skip to content

Conversation

@jalen-videotape
Copy link
Contributor

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
@jalen-videotape jalen-videotape marked this pull request as ready for review December 10, 2025 02:42
@stuartmorgan-g stuartmorgan-g added the triage-web Should be looked at in web triage label Jan 6, 2026
Copy link
Contributor

@mdebbar mdebbar left a 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!

@mdebbar mdebbar requested a review from stuartmorgan-g January 7, 2026 18:57
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 7, 2026
@auto-submit auto-submit bot merged commit 13eb63f into flutter:main Jan 7, 2026
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 8, 2026
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jan 8, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: camera platform-web triage-web Should be looked at in web triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Camera Web example doesn't work on Safari

3 participants