camera: CameraPreview displays landscape images on an mobile web when it is held in a portrait position.
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
The following steps were replicated on Flutter Web, iPhone 15, iOS 17.2.1, and Mobile Safari.
1. Hold an iPhone 15 in a portrait position (with the front-facing camera up and the charging port down).
2. Open iOS Mobile Safari.
3. Navigate to https://camera-preview-bug.web.app/.
4. Tap on the front-facing camera icon on the bottom left.
### Expected results
It is expected that CameraPreview would display portrait images, similar to the iOS camera app.

### Actual results
However, CameraPreview currently shows cropped landscape images instead.

Interestingly, when accessing the website with the phone already in a landscape position, the camera preview functions correctly. It even displays valid portrait images when the phone is rotated to a portrait position.
### Code sample
Code sample
The official camera example from https://github.com/flutter/packages/tree/main/packages/camera/camera/example was used for the website without any modifications.
### Screenshots or Video
Screenshots / Video demonstration

### Logs
Logs
```console
[Paste your logs here]
```
### Flutter Doctor output
Doctor output
```console
[✓] Flutter (Channel stable, 3.16.8, on macOS 14.2.1 23C71 darwin-arm64, locale en-US)
• Flutter version 3.16.8 on channel stable at /opt/homebrew/Caskroom/flutter/3.16.4/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 67457e669f (4 weeks ago), 2024-01-16 16:22:29 -0800
• Engine revision 6e2ea58a5c
• Dart version 3.2.5
• DevTools version 2.28.5
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.2.1 23C71 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.160
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
```
Contributor guide
Assessment
This issue has not been assessed yet.