Skip to content
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

[camera] Camera web mobile orientation #6976

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kristoffer-zliide
Copy link

Various orientation-related fixes for camera in mobile browsers, including flutter/flutter#143288 and flutter/flutter#117430. The improved video constraints might also fix the zoom behavior observed in flutter/flutter#112280. Previously closed as #6362.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

logic and remove null assertions and memory allocations.
…ation,

so we get a portrait stream when the phone is oriented as a portrait. This doesn't update the orientation, but at least we get the expected stream to start with.
…of cover, as the cover showed a "zoomed-in" version of the camera feed
… as the height/width of the camera was already correct
@stuartmorgan
Copy link
Contributor

From triage: ping @ditman and @bparrishMines on this review.

@@ -172,6 +172,8 @@ class CameraValue {
CameraDescription? description,
Optional<DeviceOrientation>? previewPauseOrientation,
}) {
assert((isRecordingVideo ?? false) ==
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this assert in copyWith necessary? This is used by other methods to freely change state, so I don't think we should be asserting anything here. Potentially this check is better in the method that changes it.

if (kIsWeb || defaultTargetPlatform != TargetPlatform.android) {
return child;
if (defaultTargetPlatform == TargetPlatform.android) {
if (kIsWeb) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this only check if the app was compiled for web?: https://api.flutter.dev/flutter/foundation/kIsWeb-constant.html

This should cause this to always be false if defaultTargetPlatform == TargetPlatform.android is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants