Open omartinma opened 1 year ago
I believe the forced sizing is due to https://github.com/flutter/plugins/blob/97d48f4cb610b4f1346e38d5a9919de145be20e6/packages/camera/camera_web/lib/src/camera_service.dart#L289.
Thanks for the report. Seeing same behavior upon running code sample provided.
I don't think this is a bug, this is just the consequence of changing the aspect ratio. No actual zoom is happening, the camera widget is just trying to display the camera full screen (without white/black bars on the side), so it cuts off top and bottom content making the image appear "zoomed".
You can easily resolve this by placing a Container around the camera and giving it constraints (for example, fixed width or height) depending on what aspect ratio you would like the camera to stick to. This will however create empty space around the camera widget when making the screen larger.
Edit: to verify that no zoom is happening, you can easily place something on the left or right edge of your camera view, then resize the window, and you will still see the object you placed there.
It's happening with me too @omartinma, only on web. Desktop and mobile are fine.
I tried setting the aspect as you said @jgoyvaerts to my camera aspect and making it small be be sure. It's zoomed in.
Desktop working example
Web square 1:1
Web camera aspect ratio, small to make sure
I have the same issue in flutter web when putting the camera preview inside a container with a different aspect ratio. The resulting container isn't overflowing on either axis and still the browser is going full screen.
It's been quite frustrating given that displaying the default camera preview without an outer container displays it with a landscape orientation even when the phone is in portrait orientation, and the resulting picture when taken is portrait too, but the preview displays it landscape.
This issue is assigned to @ditman but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
have the same issue as well
@ditman are you working on this? It seems that is has been assigned to you for some time now 🙌
This issue was assigned to @ditman but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
any update ? I am facing same issue when trying to add the aspect ration to the camera it stretching
I have the same issue
@omartinma I believe we had an issue for this in Holobooth, where we had to dependency override the plugin with the fixed implementation. Do you recall what fixed it?
Steps to Reproduce
Expected results:
The camera should not be zoomed in
Actual results:
The camera is zoomed in.
Code sample
```dart void main() => runApp(const MaterialApp(home: CameraExample())); class CameraExample extends StatefulWidget { const CameraExample({Key? key}) : super(key: key); @override StateLogs
``` No errors ``` ``` No issues found! (ran in 1.4s) ``` ``` [✓] Flutter (Channel stable, 3.3.1, on macOS 12.1 21C52 darwin-arm, locale en-ES) • Flutter version 3.3.1 on channel stable at /Users/oscarmartin/fvm/versions/3.3.1 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4f9d92fbbd (2 weeks ago), 2022-09-06 17:54:53 -0700 • Engine revision 3efdf03e73 • Dart version 2.18.0 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/oscarmartin/Library/Android/sdk • Platform android-32, build-tools 31.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13F100 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) [✓] VS Code (version 1.71.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.48.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 12.1 21C52 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```