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] Taking pictures is too slow on some devices #84957
Comments
Hi @nero-angela flutter doctor -v[✓] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.19043.1055], locale en-US)
• Flutter version 2.2.2 at C:\Users\Taha\Code\flutter_stable
• Framework revision d79295af24 (10 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\openjdk\bin\java.exe
• Java version OpenJDK Runtime Environment (build 1.8.0-262-b10)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.2)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.10.31410.357
• Windows 10 SDK version 10.0.19041.0
[!] 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/windows#android-setup for detailed instructions).
[✓] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.1
• Flutter plugin version 57.0.5
• Dart plugin version 211.7233
[✓] VS Code (version 1.57.1)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[✓] Connected device (5 available)
• SM M025F (mobile) • R9ZR205XX0A • android-arm • Android 11 (API 30)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1055]
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.48
! Doctor found issues in 1 category. Can you please share Android version you're running? Are you using stock firmware or custom rom? |
Hi @TahaTesser My android version is Android 9 (API 28) and I am using the S8 after factory reset. flutter doctor -v
flash_test.mp4 |
Also reproducible on:
(This is currently only my own device ... I will update this list, when I can go back to the office, and have more real test devices available ...) flutter doctor -v[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-arm, locale en-DE)
• Flutter version 2.2.2 at /Users/davidwimmer/flutter
• Framework revision d79295af24 (2 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/davidwimmer/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] ... all my IDEs ...
[✓] Connected device (2 available)
• ONEPLUS A6003 (mobile) • b0a181c6 • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114 |
I find the same problem in my device (Xiaomi MI 8, Android 10). The flash light terminates before the picture is taken, even with torch FlashMode on. |
This problem is also reproducible on these devices:
The flash light turns off in the moment the photo is taken. |
any update on this? same with Xiaomi Redmit Note 7 |
Same problem with Google Pixel 4a (Android 12), Nokia 8.2 (Android 11). It seems like it takes long before the camera finds it's focus. |
Independently of the flash, I too find the takePicture() method is rather slow (on my Pixel 4a 5G, same on Pixel 4a). With a very basic example, it takes over 3 seconds. You can find more detailed information below. code
console output
` flutter doctor -v`
|
what's the best way to debug this and determine a fix? do we play around with AF or AE setup? |
you can change the resolution to ResolutionPreset.medium. This are list of available values that you can experiment with /// 352x288 on iOS, 240p (320x240) on Android and Web /// 480p (640x480 on iOS, 720x480 on Android and Web) /// 720p (1280x720) /// 1080p (1920x1080) /// 2160p (3840x2160 on Android and iOS, 4096x2160 on Web) /// The highest resolution available. |
I can report same behavior on flutter doctor -v
|
I faced this issue when I upgrade camera package from 0.6.3+4. That version was lightning fast compared to new versions(>=0.7.0) ps: observed in Galaxy A21s (Android 11) and Redmi Note 10 Pro (Android 12) |
Same issue Pixel 5a (Android 12), camera package version is 0.9.8+1 |
I think the problem is the Tested on a Pixel 6 and Samsung Galaxy S9. |
Just like @Szugalew suggested I skipped the runPictureAutoFocus() and runPrecaptureSequence() in Camera.java and just running the takePictureAfterPrecapture() directly. This resulted in instant picture. Thanks sir. |
any update? |
We ran into a pretty similar issue. Users report that taking the picture takes too long, and sometimes the image is captured with a delay, not when they pushed the button. Can anybody provide more clear steps on how to edit and use the edited Edit: Tested on Samsung S22 Ultra and Pixel 5 |
Building on @DmitrySikorsky's and @Szugalew's solution: This results in a sped up process. something like 0.5s-1s instead of 3s-4s
|
It seems to only speed up the first photo. As soon as I want to take a 2nd photo, it is very slow again. Edit: Actually, it should be like this: await _controller!.setFocusMode(FocusMode.locked);
await _controller!.setExposureMode(ExposureMode.locked);
final picture = await _controller!.takePicture();
await _controller!.setFocusMode(FocusMode.auto);
await _controller!.setExposureMode(ExposureMode.auto); |
Same issue on my Huawey P30 ...no fix? |
Just mentioning that this is an issue for Samsung S9+ also (android 10), one ui 2.5. Rather old, the picture takes approx 2-5 sec to snap. |
I am having this same issue on Galaxy s22. This is universal enough we really need a fix. I don't mind modifying the java for a solution but I can see the code is bypassing features and efficiency in the name of a quick image capture. A worthwhile trade but not a long term solution. |
Same. When using this to take an image, then take another straight after I'm getting inconsistent results. Sometimes image 1 takes 1 second, other times 3 seconds. Image 2 can also take 1-3 seconds. Currently not a usable solution so please investigate asap. |
In this case exposure is not getting reset. and I'm getting this logs in console
|
Pinning |
This definitely results in the camera capture being much faster for me when tested on Pixel 7. But it does have to be this exact version (0.10.8+3 of camera_android). More recent versions of camera_android than that are also really slow. |
I have probably found the source of the autofocus timeout bug that delays image capture, but cannot verify. In this diff of changes between 0.10.8+3 and 0.10.8+4, there is a typo on line 34. There should be
instead of
Ping commit author @stuartmorgan |
Fixes a typo introduced during a testability refactor that caused the capture state machine to read the wrong value for autofocus state, breaking the state machine. Fixes flutter/flutter#135554 Part of flutter/flutter#84957
@altermark Thanks for finding that mistake! I have a PR up to fix it. (This is not expected to fix the original issue here, since the issue was filed far earlier than that mistake was introduced.) |
Fixes a typo introduced during a testability refactor that caused the capture state machine to read the wrong value for autofocus state, breaking the state machine. Fixes flutter/flutter#135554 Part of flutter/flutter#84957
Hello guys, Im seeing long time in taking a pic on xiaomi mi lite 5g android 13 (almost 3sec). What is the latest / most effective workaround for this, if any? |
@delfme as |
Thx @Tienisto, just checked the fix on my xiaomi mi lite 5g and it works 👍 |
Also seeing delay in Samsung M31, Samsung M31s, Poco F4 when calling takePicture(). Please solve this issue as this issue has been lingering for almost 2.5 years now and for a basic and necessary package like camera, really limits the potential for flutter apps. |
Fixes a typo introduced during a testability refactor that caused the capture state machine to read the wrong value for autofocus state, breaking the state machine. Fixes flutter/flutter#135554 Part of flutter/flutter#84957
This issue should be fixed in the CameraX implementation of the camera plugin, so please try it out! If you find a similar issue with that implementation (or any other issues), please feel free to file a separate issue. |
@camsim99 camera: 0.10.5+2
camera_android_camerax: 0.6.1+1 |
Hi, I'm making a camera app with samsung s8 device and camera package.
However, there is a problem with the shooting speed being too slow on the Android device.
It takes about 0.5 to 1.5 second to shoot. (I used camera/example for testing)
The shooting speed on the Android(S8) is too slow, so even if I shoot with the flash on, the flash effect is not applied because the shooting is completed after the flash is off.
I wonder if it's a fundamental problem with the package, or it's a problem that only occurs on my S8.
Steps to Reproduce
Expected results:
Photo with flash effect applied.
Actual results:
Photos without flash effect applied.
The text was updated successfully, but these errors were encountered: