Git Product home page Git Product logo

flutter_better_camera's People

Contributors

adamdupuis avatar alexvillard avatar driverzhan avatar gummie4444 avatar ro0t avatar roxifas avatar yanivshaked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_better_camera's Issues

Is it possible to record a video while using imageStream with camera plugin?

Hello. I am trying to use the camera plugin for two purposes in my app:

  1. Allow the user to record a video
  2. Process the video alongside recording with some AI models

I tried to use the camera plugin with two controllers.

  CameraController _cameraRecordingController;
  CameraController _cameraImageStreamController;
.
.
.
// initiate controllers
      if (_cameraRecordingController == null ||
          !_cameraRecordingController.value.isInitialized) {
        _cameraRecordingController = CameraController(
          CameraBloc.cameras[0],
          ResolutionPreset.high,
          enableAudio: false,
        );
        await _cameraRecordingController.initialize();
        await _cameraRecordingController.prepareForVideoRecording();
      }

      if (_cameraImageStreamController == null ||
          !_cameraImageStreamController.value.isInitialized) {
        _cameraImageStreamController = CameraController(
          CameraBloc.cameras[0],
          ResolutionPreset.medium,
          enableAudio: false,
        );
        await _cameraImageStreamController.initialize();
      }
.
.
.
// start recording and imagestream one -by-one
        await _cameraRecordingController.startVideoRecording(event.filePath);
        await _cameraImageStreamController.startImageStream((img) {
          // Do image processing here
        });
.
.
.
.
// finally stop the controllers
        if (_cameraImageStreamController.value.isInitialized)
          await _cameraImageStreamController.stopImageStream();

        if (_cameraRecordingController.value.isInitialized)
          await _cameraRecordingController.stopVideoRecording();

The two controllers are for recording and imagestream respectively.
Do you think this is the right approach of using this plugin for my use-case (I was getting some weird behavior when doing this ex. the camerapreview was hung on a single frame many times)? Is there a better way of doing this (even if not using this plugin)?

Detect which camera has flash?

In your example, you are hardcoding
bool hasFlash = false;

Is there a better way to determine which camera has a flash than hardcode it to the rear camera?

Flash not working on some phones

Hi,
As the title suggests, I tried to use the flash functionality on three phones but only two works. It works on Samsung Galaxy J2 (Android 6.0.1) Prime and Xiaomi Mi A2 (Android 10), but doesn't work on Samsung Galaxy S10 (Android 10). There is no error on the log too. Does someone have the same issue and found a fix?

iOS crash with error onCancelWithArguments

Seldom crash on iOS, but it does occur now and again. here is the error log:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000068523559d350
Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x1b0f8b1e0 objc_msgSend + 32
1  Flutter                        0x1063f1380 (Missing)
2  flutter_better_camera          0x106229948 -[FLTCam onCancelWithArguments:] + 48
3  Flutter                        0x1069a141c (Missing)
4  Flutter                        0x1064180d8 (Missing)
5  Flutter                        0x106714f8c (Missing)
6  Flutter                        0x1066b5d94 (Missing)
7  Flutter                        0x1066b7bf4 (Missing)
8  CoreFoundation                 0x19c46522c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
9  CoreFoundation                 0x19c464e28 __CFRunLoopDoTimer + 1076
10 CoreFoundation                 0x19c464278 __CFRunLoopDoTimers + 328
11 CoreFoundation                 0x19c45e02c __CFRunLoopRun + 1944
12 CoreFoundation                 0x19c45d360 CFRunLoopRunSpecific + 600
13 GraphicsServices               0x1b3a9b734 GSEventRunModal + 164
14 UIKitCore                      0x19eed8584 -[UIApplication _run] + 1072
15 UIKitCore                      0x19eedddf4 UIApplicationMain + 168
16 Runner                         0x104a03a70 main + 15 (AppDelegate.swift:15)
17 libdyld.dylib                  0x19c119cf8 start + 4

[Android] Autofocus feature delays image capture indefinitely until the camera can focus

Current Behavior
On Android, when autofocus is enabled (the default behavior), a photo is not actually taken until the camera focuses. In other words, the user might press the "Take Photo" button while moving the camera around, and the plugin will wait indefinitely until the user stops moving the camera, and then it will take the photo. As a result, the camera might snap a photo of something entirely different than what it was pointed at when the user tried to take a photo.

Expected Behavior
The camera should immediately take a photo when takePicture is called, even if the camera has not gotten a chance to focus.

I need torch on iOS

Hi! I'm student and I'm developing an android + iOS app in my final university project.

I use this package to get user's heart rate, so I need to use the camera flash. On Android devices, it works perfectly; but on iOS, the flash never activates. I'm doing it like this:
await _cameraController.setFlashMode(FlashMode.torch);

Is it wrong or is there other way to turn on the flash? I've tried to use a couple of packages at the same time, but it says that the camera is already being used.

Thank you very much! I'm looking forward to your responses. Greetings from Spain!

Greeting message

We are grateful to you for adding things that this library flutter team didn't care about. I and my team will let you know if there is an error or a performance issue for the library to improve.

Thank you ! Best regards

Android 12 Camera issue - Front camera working fine, back camera not working

I am getting this error for Android 12 OS device.. Let me know once this issue is fixed...

D/Camera2BasicFragment(24827): ONCAPTURECOMPLETED
D/Camera2BasicFragment(24827): UNLOCK FOCUS
D/EGL_emulation(24827): app_time_stats: avg=187.77ms min=36.22ms max=552.19ms count=6
D/EGL_emulation(24827): app_time_stats: avg=176.55ms min=105.06ms max=243.99ms count=6
E/CameraCaptureSession(24827): Session 0: Exception while stopping repeating:
E/CameraCaptureSession(24827): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2350)
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1277)
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
E/CameraCaptureSession(24827): at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:949)
E/CameraCaptureSession(24827): at io.flutter.plugins.camera.Camera.close(Camera.java:955)
E/CameraCaptureSession(24827): at io.flutter.plugins.camera.Camera$2.onError(Camera.java:291)
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1748)
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraDeviceImpl.$r8$lambda$KBQCqQRdhVVn7uHI9Xdha6OqnsU(Unknown Source:0)
E/CameraCaptureSession(24827): at android.hardware.camera2.impl.CameraDeviceImpl$$ExternalSyntheticLambda0.accept(Unknown Source:8)
E/CameraCaptureSession(24827): at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:281)
E/CameraCaptureSession(24827): at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
E/CameraCaptureSession(24827): at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
E/CameraCaptureSession(24827): at android.os.Handler.handleCallback(Handler.java:938)
E/CameraCaptureSession(24827): at android.os.Handler.dispatchMessage(Handler.java:99)
E/CameraCaptureSession(24827): at android.os.Looper.loopOnce(Looper.java:201)
E/CameraCaptureSession(24827): at android.os.Looper.loop(Looper.java:288)
E/CameraCaptureSession(24827): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/CameraCaptureSession(24827): at java.lang.reflect.Method.invoke(Native Method)
E/CameraCaptureSession(24827): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/CameraCaptureSession(24827): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

App crashes on android when after denying permission you go back to camera screen

This is the Minimal Viable Example:

import 'package:flutter/material.dart';
import 'package:flutter_better_camera/camera.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          child: Text('Navigate'),
          onPressed: () {
            Navigator.of(context).push(
              MaterialPageRoute(
                builder: (context) => Camera(),
              ),
            );
          },
        ),
      ),
    );
  }
}

class Camera extends StatefulWidget {
  @override
  _CameraState createState() => _CameraState();
}

class _CameraState extends State<Camera> {
  CameraController _controller;

  @override
  void initState() {
    super.initState();
    _init();
  }

  Future<void> _init() async {
    final _cameras = await availableCameras();
    _controller = CameraController(_cameras[0], ResolutionPreset.high);
    await _controller.initialize();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _controller == null ? Container() : CameraPreview(_controller),
    );
  }
}

Steps to reproduce:

  1. Run the program
  2. Click on the center of the navigate button at the center of the screen
  3. Deny both permissions
  4. Press back button
  5. Click on navigate button again

Here is the stack trace:

D/AndroidRuntime( 6540): Shutting down VM
E/AndroidRuntime( 6540): FATAL EXCEPTION: main
E/AndroidRuntime( 6540): Process: com.example.camera_bug, PID: 6540
E/AndroidRuntime( 6540): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=9796, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.example.camera_bug/com.example.camera_bug.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 6540): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5015)
E/AndroidRuntime( 6540): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
E/AndroidRuntime( 6540): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 6540): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 6540): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 6540): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime( 6540): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 6540): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 6540): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime( 6540): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6540): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 6540): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime( 6540): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 6540): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:139)
E/AndroidRuntime( 6540): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:243)
E/AndroidRuntime( 6540): 	at io.flutter.plugins.camera.MethodCallHandlerImpl.lambda$onMethodCall$0$MethodCallHandlerImpl(MethodCallHandlerImpl.java:74)
E/AndroidRuntime( 6540): 	at io.flutter.plugins.camera.-$$Lambda$MethodCallHandlerImpl$OMU5dV7VCKXKBT37_ThIybqlHuo.onResult(Unknown Source:6)
E/AndroidRuntime( 6540): 	at io.flutter.plugins.camera.CameraPermissions.lambda$requestPermissions$0$CameraPermissions(CameraPermissions.java:37)
E/AndroidRuntime( 6540): 	at io.flutter.plugins.camera.-$$Lambda$CameraPermissions$5yqyw-OpZZu-E824jQ34RA2nmFk.onResult(Unknown Source:4)
E/AndroidRuntime( 6540): 	at io.flutter.plugins.camera.CameraPermissions$CameraRequestPermissionsListener.onRequestPermissionsResult(CameraPermissions.java:75)
E/AndroidRuntime( 6540): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:664)
E/AndroidRuntime( 6540): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:364)
E/AndroidRuntime( 6540): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:579)
E/AndroidRuntime( 6540): 	at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:601)
E/AndroidRuntime( 6540): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8466)
E/AndroidRuntime( 6540): 	at android.app.Activity.dispatchActivityResult(Activity.java:8314)
E/AndroidRuntime( 6540): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5008)
E/AndroidRuntime( 6540): 	... 11 more

Exposure compensation and tap to exposure

Hi,
Can you add the exposure compensation function?
I saw the complete code on a pull request of flutter "camera" plugin.
So you just need to copy/paste the code.
I already did it with standard flutter camera, but I think I'll do it again using this better_camera as starting point (so I could have more features).

But after that, I'd like to ask you if you can implement a tap to exposure function (like tap to focus but for exposure) that works with exposure compensation mentioned before.

In this way I can tap on dark areas of my picture to expose there, and then compensate with +2 for example.

Thank you in advance.

Hard app crash on iOS 13.x & iOS 14 with `unrecognized selector sent to instance 0x1f2929f00`

Really hard to debug this as it doesn't happen on Android obviously but on iOS 13.x & iOS 14 with Xcode 11.7 the following hard app crash occurs.

2020-09-23 13:10:19.931208-0700 Runner[57108:1957620] play!
2020-09-23 13:10:19.931353-0700 Runner[57108:1957620] -[NSNull boolValue]: unrecognized selector sent to instance 0x1f2929f00
2020-09-23 13:10:19.933314-0700 Runner[57108:1957620] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull boolValue]: unrecognized selector sent to instance 0x1f2929f00'
*** First throw call stack:
(0x1a5990114 0x1b91b6cb4 0x1a58a09b8 0x1a5992758 0x1a59946cc 0x108c9be98 0x108c9b104 0x1055ab554 0x104db7524 0x105074220 0x104dbfd80 0x104dc21b0 0x1a5910a30 0x1a5910634 0x1a590fb14 0x1a5909eb0 0x1a5909200 0x1bba04598 0x1a81cf004 0x1a81d45d8 0x102101724 0x1a55e8598)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull boolValue]: unrecognized selector sent to instance 0x1f2929f00'
terminating with uncaught exception of type NSException
(lldb) 

Digging into the only thing I was able to find was this 
![Screen Shot 2020-09-23 at 1 17 43 PM](https://user-images.githubusercontent.com/3769441/94066596-8cae0c00-fda1-11ea-8f92-543a916768a0.png)

Android - taking image with zoom works only without flash

Hi, when I set some zoom, the preview is OK and is taking pictures, however if the flash is ON, the image is taken but with zoom 1.
If the flash mode is off it works as expected.

I have tried after set flash mode to set the zoom again in case set flash mode resets the zoom, but it looks like the zoom never changes, just images with flash has zoom 1, no matter what zoom I have set.
I can experience this with alwaysFlash and torch mode, when use autoFlash it hangs for a few seconds until the image is taken and then is again without zoom.

Sometimes it hangs for longer and need to kill the app and start it again to work the camera correct.

This is happening on android only (Pixel 3a XL, Samsung A52016 and Redmi 7)

Thanks in advance!

Camera lockCaptureOrientation will come?

The lockCaptureOrientation method will come to the package any time soon?

I'm trying to lock the camera in portrait mode, my app is already locked on portrait mode, but the camera just ignore that and change his orientation if I turn the phone a bit to the left or right.

By the way, great work with the package, was the only one that solved a problem with taking photos with the main back camera.

flash always on

hi, nice work! i would like to keep flash always on. Currently it starts and then stops with camerapreview,

[iOS] Can not turn on flash on iOS device, but it work fine on Android device

I have a problem when turn on/off the flash.
I am using flutter_better_camera: 1.0.2+1

Here is code using in my app:

//Turn off
controller.setFlashMode(FlashMode.off);

//Turn on
controller.setFlashMode(FlashMode.torch);

This code not work on iOS device. But work fine on Android device.
Image 9-15-21 at 09 27

I was try catch but don't have any exception.
Pls help me check it. Thank in advance

Camera crash on iOS with Flutter 3.0.5

Hi, with version 1.0.1 , 1.0.2 and 1.0.2+1
when I try to init the camera it crashes the app on iOS.
This is somehow related to Flutter version 3.0.5, with Flutter 2.10.4 version 1.0.1 worked with no problem.

Thanks in advance!

Here are my Logs :

flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ 🐛 2022-08-02 13:54:57.384222 DEBUG AppLog CameraBloc : Has flash true
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ 🐛 2022-08-02 13:54:57.385934 DEBUG AppLog CameraBloc : initializeCameraController
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ 🐛 2022-08-02 13:54:57.393566 DEBUG AppLog CameraBloc : cameras [CameraDescription(com.apple.avfoundation.avcapturedevice.built-in_video:0, CameraLensDirection.back, 90), CameraDescription(com.apple.avfoundation.avcapturedevice.built-in_video:1, CameraLensDirection.front, 90)]
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ 🐛 2022-08-02 13:54:57.396570 DEBUG AppLog CameraBloc : PermissionStatus.granted
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ 🐛 2022-08-02 13:54:57.397339 DEBUG AppLog CameraBloc : _initCamera
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[VERBOSE-3:platform_message_handler_ios.mm(106)] Check failed: task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread().
* thread #37, queue = 'io.flutter.camera.dispatchqueue', stop reason = signal SIGABRT
    frame #0: 0x00000001bba08bbc libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1bba08bbc <+8>:  b.lo   0x1bba08bd8               ; <+36>
    0x1bba08bc0 <+12>: stp    x29, x30, [sp, #-0x10]!
    0x1bba08bc4 <+16>: mov    x29, sp
    0x1bba08bc8 <+20>: bl     0x1bba0460c               ; cerror_nocancel
Target 0: (Runner) stopped.
Lost connection to device.

Tested on iPhoneX - iOS 15.4.1

flutter doctor --verbose
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en-BG)
• Flutter version 3.0.5 at /Users/galeen/soft/flutter2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/galeen/Library/Android/sdk
• Platform android-31, build-tools 30.0.2
• ANDROID_HOME = /Users/galeen/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
• 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.12+0-b1504.28-7817840)

[✓] Connected device (3 available)
• FL iPhone X (mobile) • e698b0ece23b534f74e736ed49046f021c6afe2c • ios • iOS 15.4.1 19E258
• macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

iOS 14 crash when minimising and resuming app on preview

This crash only occurs sometimes when the app is minimised and resumed on iOS. The logs are:

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00007356dbc81bd0
Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x1bc87a1e0 objc_msgSend + 32
1  Flutter                        0x106539380 (Missing)
2  flutter_better_camera          0x106385948 -[FLTCam onCancelWithArguments:] + 48
3  Flutter                        0x106ae941c (Missing)
4  Flutter                        0x1065600d8 (Missing)
5  Flutter                        0x10685cf8c (Missing)
6  Flutter                        0x1067fdd94 (Missing)
7  Flutter                        0x1067ffbf4 (Missing)
8  CoreFoundation                 0x1a7d5422c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
9  CoreFoundation                 0x1a7d53e28 __CFRunLoopDoTimer + 1076
10 CoreFoundation                 0x1a7d53278 __CFRunLoopDoTimers + 328
11 CoreFoundation                 0x1a7d4d02c __CFRunLoopRun + 1944
12 CoreFoundation                 0x1a7d4c360 CFRunLoopRunSpecific + 600
13 GraphicsServices               0x1bf38a734 GSEventRunModal + 164
14 UIKitCore                      0x1aa7c7584 -[UIApplication _run] + 1072
15 UIKitCore                      0x1aa7ccdf4 UIApplicationMain + 168
16 Runner                         0x104b4fa70 main + 15 (AppDelegate.swift:15)
17 libdyld.dylib                  0x1a7a08cf8 start + 4

On iPad availableCameras() does not return

Hi thanks for this great plugin.
I have an issue on iPads only.
When I try to initialise the camera it stops at await availableCameras();
Has anyone seen such problem?

Thanks in advance!

Testing on iPad 9th 15.3.1 and iPad mini 5th Generation 15.4

flutter_better_camera: ^1.0.2+1

[✓] Flutter (Channel stable, 2.5.3, on macOS 12.2.1 21D62 darwin-x64, locale en-BG)
• Flutter version 2.5.3 at /Users/galeen/soft/flutter2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (6 months ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.3, Build version 13E113
• CocoaPods version 1.11.2

void initializeCameraController() async {
    Log.d("initializeCameraController", tag);
    try {
      var cameras = await availableCameras();
      
      //this log is never called on iPad
      Log.d("cameras $cameras", tag);

      var resolutionPreset = getResolutionPreset();

      if (resolutionPreset == null) {
            Log.d("Missing resolutionPreset", tag);

            return;
          }

      cameraController = CameraController(cameras[0], resolutionPreset,
              enableAudio: false, enableAutoExposure: false, autoFocusEnabled: true);

      await PermissionHandlerService().requestCameraPermission(
              onHasPermission: _initCamera,
              onShowExplainDialog: () {
                add(ShowPermissionDialog());
              },
          tag: tag);
    } catch (e) {
      Log.error("initializeCameraController", error: e, tag: tag);
    }
  }

setAutoFocus is not implemented on iOS

setAutoFocus on iOS does not seem to be implemented. This should at least be documented?

flutter: Caught error: MissingPluginException(No implementation found for method setAutoFocus on channel plugins.flutter.io/camera)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.