-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
What package does this bug report belong to?
camera
What target platforms are you seeing this bug on?
Android
Have you already upgraded your packages?
Yes
Dependency versions
No response
Steps to reproduce
In production I have an app using the camera_android plugin that just uses the frame streaming feature. I've been pinning version 0.10.8+18 for a while because we found an issue after updating to 0.10.9. Some users reported a dark camera preview.
After some investigation, I believe the issue is because of the call to this.cameraFeatures.setFpsRange in the Camera constructor. That is the only difference in behavior that .9 and .8+18 have.
Setting the fos range to a single value might be interfeering with the camera exposure. See:
https://stackoverflow.com/a/54411665
I propose 2 solutions:
- Don't change the default fps range unless providing a non null/nonzero fps parameter.
- Move the setFpsRange call to where the plugin starts recording.
P.D. We are waiting on some maturity on the camerax package before making the change. The camera streaming is a critical part on my app. Related #165092
Expected results
No dark preview
Actual results
The camera preview shows dark on some devices.
Code sample
The camera example app
Screenshots or Videos
Logs
No response
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.29.2, on Fedora Linux 41 (Workstation Edition)
6.13.5-200.fc41.x86_64, locale en_US.UTF-8) [97ms]
• Flutter version 3.29.2 on channel stable at
/home/david/.local/share/mise/installs/flutter/3.29.2-stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c236373904 (6 days ago), 2025-03-13 16:17:06 -0400
• Engine revision 18b71d647a
• Dart version 3.7.2
• DevTools version 2.42.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.0s]
• Android SDK at /home/david/Android/Sdk/
• Platform android-35, build-tools 35.0.0
• Java binary at: /home/david/opt/android-studio/jbr/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)
• All Android licenses accepted.
[✓] Chrome - develop for the web [17ms]
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop [226ms]
• clang version 19.1.7 (Fedora 19.1.7-3.fc41)
• cmake version 3.30.8
• ninja version 1.12.1
• pkg-config version 2.3.0
[✓] Android Studio (version 2024.2) [14ms]
• Android Studio at /home/david/opt/android-studio/
• 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
• android-studio-dir = /home/david/opt/android-studio/
• Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)
[✓] VS Code (version 1.98.2) [13ms]
• VS Code at /usr/share/code
• Flutter extension version 3.106.0
[✓] Connected device (3 available) [203ms]
• CPH2581 (mobile) • b91b13ee • android-arm64 • Android 15 (API 35)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 41 (Workstation Edition)
6.13.5-200.fc41.x86_64
• Chrome (web) • chrome • web-javascript • Google Chrome 134.0.6998.35
[✓] Network resources [262ms]
• All expected network resources are available.
• No issues found!