-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera_web] Add support for device orientation #4219
[camera_web] Add support for device orientation #4219
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.
It's a shame that the Device Orientation API is not supported at all in Safari/Safari IOS. This should definitely be part of the documentation of the plugin, otherwise we're going to receive a lot of complaints :)
Other than that, LGTM!
if (orientation != null && documentElement != null) { | ||
// Full-screen mode may be required to modify the device orientation. | ||
// See: https://w3c.github.io/screen-orientation/#interaction-with-fullscreen-api | ||
documentElement.requestFullscreen(); |
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.
If the orientation is locked, do we need to requestFullscreen? Wouldn't this already be in fullscreen?
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, this can be skipped here. Will remove it.
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.
Removed in #4226.
throw UnimplementedError( | ||
'onDeviceOrientationChanged() is not implemented.', | ||
); | ||
final orientation = window?.screen?.orientation; |
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'm surprised these are not breaking analysis, we used to require to specify types in these definitions.
Adds support for device orientation to the web camera platform.
OrientationType
representing a screen orientation type of the browser (ScreenOrientation.type
).lockCaptureOrientation
implementation.ScreenOrientation.lock
.PlatformException
when the screen orientation API is not supported.unlockCaptureOrientation
implementation.ScreenOrientation.unlock
.PlatformException
when the screen orientation API is not supported.onDeviceOrientationChanged
implementation.ScreenOrientation.onchange
.Part of flutter/flutter#45297.
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).