-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera_web] Add support for a flash mode #4222
[camera_web] Add support for a flash mode #4222
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.
Let's go!
final shouldEnableTorchMode = | ||
flashMode == FlashMode.auto || flashMode == FlashMode.always; |
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.
I think this is going to be slightly odd behavior, but I'm not sure how this can be implemented, other than the highly experimental fillLightMode constraint.
Can we add a comment around here explaining why takePicture
does slightly different things than setFlashMode
? Somebody tracing this will see:
setFlashMode set to auto (explicitly DOESN'T SET torchMode
-> takePicture sets torchMode to true
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.
Good point, will add a comment for that!
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.
Added in #4227.
Adds support for a flash mode to the web camera platform.
setFlashMode
toCamera
.torch
(otherwise disables).CameraWebException
if the torch mode is not supported in the current browser or the camera has not been initialized or started.Camera.stream
property.takePicture
inCamera
.auto
oralways
.setFlashMode
implementation to the camera plugin.setFlashMode
on the camera with the given id.Part of flutter/flutter#45297.
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).