A flutter plugin to handle Android / iOS camera

Overview

camerawesome_logo

Awesome Flutter Star on Github Star on Github

🚀   Overview

Flutter plugin to add Camera support inside your project.

CamerAwesome include a lot of useful features like:

  • 📲 Live camera flip ( switch between rear & front camera without rebuild ).
  • ⚡️ No init needed, just add CameraAwesome widget !
  • ⌛️ Instant focus.
  • 📸 Device flash support.
  • 🎚 Zoom.
  • 🖼 Fullscreen or SizedBox preview support.
  • 🎮 Complete example.
  • 🎞 Taking a picture ( of course 😃 ).
  • 🎥 Video recording (iOS only for now).

🧐   Live example

Taking photo 📸 & record video 🎥 Resolution changing 🌇
camerawesome_example1 camerawesome_example2

📖   Installation and usage

Set permissions

  • iOS add these on ios/Runner/Info.plist file
<key>NSCameraUsageDescription</key>
<string>Your own description</string>

<key>NSMicrophoneUsageDescription</key>
<string>To enable microphone access when recording video</string>
  • Android

    • Set permissions before <application>

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    • Change the minimum SDK version to 21 (or higher) in android/app/build.gradle

    minSdkVersion 21
    

Import the package

import 'package:camerawesome/camerawesome_plugin.dart';

Define notifiers (if needed) & controller

ValueNotifier is a useful change notifier from Flutter framework. It fires an event on all listener when value changes. Take a look here for ValueNotifier doc

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
  // [...]
  // Notifiers
  ValueNotifier<CameraFlashes> _switchFlash = ValueNotifier(CameraFlashes.NONE);
  ValueNotifier<Sensors> _sensor = ValueNotifier(Sensors.BACK);
  ValueNotifier<CaptureModes> _captureMode = ValueNotifier(CaptureModes.PHOTO);
  ValueNotifier<Size> _photoSize = ValueNotifier(null);

  // Controllers
  PictureController _pictureController = new PictureController();
  VideoController _videoController = new VideoController();
  // [...]
}

If you want to change a config, all you need is setting the value. CameraAwesome will handle the rest.

Examples:

_switchFlash.value = CameraFlashes.AUTO;
_captureMode.value = CaptureModes.VIDEO;

Create your camera

// [...]
@override
  Widget build(BuildContext context) {
    return CameraAwesome(
      testMode: false,
      onPermissionsResult: (bool result) { },
      selectDefaultSize: (List<Size> availableSizes) => Size(1920, 1080),
      onCameraStarted: () { },
      onOrientationChanged: (CameraOrientations newOrientation) { },
      zoom: 0.64,
      sensor: _sensor,
      photoSize: _photoSize,
      switchFlashMode: _switchFlash,
      captureMode: _captureMode,
      orientation: DeviceOrientation.portraitUp,
      fitted: true,
    );
  };
// [...]
Reveal parameters list

Param Type Description Required
testMode boolean true to wrap texture
onPermissionsResult OnPermissionsResult implement this to have a callback after CameraAwesome asked for permissions
selectDefaultSize OnAvailableSizes implement this to select a default size from device available size list
onCameraStarted OnCameraStarted notify client that camera started
onOrientationChanged OnOrientationChanged notify client that orientation changed
switchFlashMode **ValueNotifier**<CameraFlashes> change flash mode
zoom ValueNotifier<double> Zoom from native side. Must be between 0 and 1
sensor ValueNotifier<Sensors> sensor to initiate BACK or FRONT
photoSize ValueNotifier<Size> choose your photo size from the [selectDefaultSize] method
captureMode ValueNotifier<CaptureModes> choose capture mode between PHOTO or VIDEO
orientation DeviceOrientation initial orientation
fitted bool whether camera preview must be as big as it needs or cropped to fill with. false by default
imagesStreamBuilder Function returns an imageStream when camera has started preview

Photo 🎞

Take a photo 📸

await _pictureController.takePicture('THE_IMAGE_PATH/myimage.jpg');

Video 🎥

Record a video 📽

await _videoController.recordVideo('THE_IMAGE_PATH/myvideo.mp4');

Stop recording video 📁

await _videoController.stopRecordingVideo();

📡   Live image stream

The property imagesStreamBuilder allows you to get an imageStream once the camera is ready. Don't try to show all these images on Flutter UI as you won't have time to refresh UI fast enough. (there is too much images/sec).

CameraAwesome(
    ...
    imagesStreamBuilder: (imageStream) {
        /// listen for images preview stream
        /// you can use it to process AI recognition or anything else...
        print('-- init CamerAwesome images stream');
    },
)

📱   Tested devices

CamerAwesome was developed to support most devices on the market but some feature can't be fully functional. You can check if your device support all feature by clicking bellow.

Feel free to contribute to improve this compatibility list.

Reveal grid

Devices Flash Focus Zoom Flip
iPhone X
iPhone 7
One Plus 6T
Xiaomi redmi
Honor 7

🎯   Our goals

Feel free to help by submitting PR !

  • 🎥 Record video (partially, iOS only)
  • 🌠 Focus on specific point
  • 📡 Broadcast live image stream
  • 🌤 Exposure level
  • Add e2e tests
  • 🖼 Fullscreen/SizedBox support
  • 🎮 Complete example
  • 🎞 Take a picture
  • 🎚 Zoom level
  • 📲 Live switching camera
  • 📸 Device flash support
  • ⌛️ Auto focus

📣   Sponsor


Initiated and sponsored by Apparence.io.

👥   Contribution

Contributions are welcome. Contribute by creating a PR or create an issue 🎉 .

Comments
  • Vidéo support

    Vidéo support

    Proposal

    Describe your new feature Video support: are there any work in a pr for this? By the way thanks for this great package. I wish it was an official package by Flutter but I guess they don't have time for camera. I am glad you guys help us here.

    enhancement android 
    opened by aytunch 27
  • Development status - we need help

    Development status - we need help

    Edit on 9/7/2022: We don't plan anymore to deprecate this package

    Thanks to all people that contributed to this thread it seems clear that

    • this package helps many people.
    • it provides a different experience/features than the official one and seems to help many
    • it's hard to think of pushing cameraX on the official plugin without rewriting everything. But we certainly can try here.

    Do you want to help? Write us here.

    Next step

    • [ ] create a public feature board
    • [ ] finish testing cameraX on Android
    • [ ] migrate to pigeon
    • [ ] creating a web interface
    question priority 1 
    opened by g-apparence 21
  • Ipad orientation with custom builder

    Ipad orientation with custom builder

    Steps to Reproduce

    This is my setup:

    import 'package:auto_route/auto_route.dart';
    import 'package:camerawesome/pigeon.dart';
    import 'package:flutter/material.dart';
    
    import 'package:path_provider/path_provider.dart';
    import 'package:camerawesome/camerawesome_plugin.dart';
    import 'camera_countdown.dart';
    import 'camera_layout.dart';
    import 'package:uuid/uuid.dart';
    
    export 'package:camerawesome/camerawesome_plugin.dart' show CaptureMode;
    
    class CameraPageResponse {
      CameraPageResponse({required this.filePath});
      final String filePath;
    }
    
    class CameraPage extends StatelessWidget {
      const CameraPage({
        super.key,
        this.captureMode = CaptureMode.photo,
        this.maxVideoDuration,
      });
    
      final CaptureMode captureMode;
      final Duration? maxVideoDuration;
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: CameraAwesomeBuilder.custom(
            initialCaptureMode: captureMode,
            saveConfig: captureMode == CaptureMode.photo
                ? SaveConfig.photo(
                    pathBuilder: () async {
                      final extDir = await getApplicationDocumentsDirectory();
                      return '${extDir.path}/${const Uuid().v4()}.jpg';
                    },
                  )
                : SaveConfig.video(
                    pathBuilder: () async {
                      final extDir = await getApplicationDocumentsDirectory();
                      return '${extDir.path}/${const Uuid().v4()}.mp4';
                    },
                  ),
            exifPreferences: ExifPreferences(
              saveGPSLocation: true,
            ),
            builder: (cameraState) {
              return cameraState.when(
                onPreparingCamera: (state) =>
                    const Center(child: CircularProgressIndicator()),
                onPhotoMode: (state) => _TakePhotoUI(state),
                onVideoMode: (state) => _RecordVideoUI(state),
                onVideoRecordingMode: (state) => _RecordVideoUI(
                  state,
                  maxVideoDuration: maxVideoDuration,
                ),
              );
            },
          ),
        );
      }
    }
    
    class _TakePhotoUI extends StatefulWidget {
      final PhotoCameraState state;
    
      const _TakePhotoUI(this.state);
    
      @override
      State<_TakePhotoUI> createState() => _TakePhotoUIState();
    }
    
    class _TakePhotoUIState extends State<_TakePhotoUI> {
      @override
      void initState() {
        super.initState();
        widget.state.captureState$.listen((event) {
          if (event != null && event.status == MediaCaptureStatus.success) {
            context.router.pop<CameraPageResponse>(
              CameraPageResponse(filePath: event.filePath),
            );
          }
        });
      }
    
      @override
      Widget build(BuildContext context) {
        return AwesomeCameraLayout(state: widget.state);
      }
    }
    
    class _RecordVideoUI extends StatefulWidget {
      final CameraState state;
      final Duration? maxVideoDuration;
    
      const _RecordVideoUI(
        this.state, {
        this.maxVideoDuration,
      });
    
      @override
      State<_RecordVideoUI> createState() => _RecordVideoUIState();
    }
    
    class _RecordVideoUIState extends State<_RecordVideoUI> {
      @override
      void initState() {
        super.initState();
        widget.state.captureState$.listen((event) {
          if (event != null && event.status == MediaCaptureStatus.success) {
            context.router.pop<CameraPageResponse>(
              CameraPageResponse(filePath: event.filePath),
            );
          }
        });
      }
    
      @override
      Widget build(BuildContext context) {
        return Stack(children: [
          AwesomeCameraLayout(state: widget.state),
          if (widget.state is VideoRecordingCameraState &&
              widget.maxVideoDuration != null)
            Positioned(
              bottom: 20,
              right: 10,
              child: CameraCountdown(
                time: widget.maxVideoDuration!,
                callback: () {
                  (widget.state as VideoRecordingCameraState).stopRecording();
                },
              ),
            ),
        ]);
      }
    }
    
    

    Expected results

    Expect to get a new photo.

    Actual results

    When I try to take a photo I get this error message:

    [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'bool'
    #0      PhotoCameraState.takePhoto
    package:camerawesome/…/states/photo_camera_state.dart:58
    <asynchronous suspension>
    

    and no photo is created.

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Apple | iPad (7th gen) | 16.2 |

    bug iOS 
    opened by KirioXX 16
  • Android app carshes on first run

    Android app carshes on first run

    Steps to Reproduce

    Install a app for first time with this dependency and you get the error Describe how to reproduce the error Uninstall all versions of your app from the app and reinstall. Error appears at launch and app crashes

    Expected results

    App to load What it should be

    Actual results

    App crashes What you see Below error: E/AndroidRuntime( 7923): java.lang.RuntimeException: Unable to destroy activity {mypackage.myapp/mypackage.myapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.apparence.camerawesome.CameraPreview.setMainHandler(android.os.Handler)' on a null object reference E/AndroidRuntime( 7923): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5105) E/AndroidRuntime( 7923): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5135) E/AndroidRuntime( 7923): at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5427) E/AndroidRuntime( 7923): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5357) E/AndroidRuntime( 7923): at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69) E/AndroidRuntime( 7923): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime( 7923): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime( 7923): at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58) E/AndroidRuntime( 7923): at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5410) E/AndroidRuntime( 7923): at android.app.ActivityThread.access$3300(ActivityThread.java:237) E/AndroidRuntime( 7923): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2076) E/AndroidRuntime( 7923): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime( 7923): at android.os.Looper.loop(Looper.java:223) E/AndroidRuntime( 7923): at android.app.ActivityThread.main(ActivityThread.java:7660) E/AndroidRuntime( 7923): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 7923): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/AndroidRuntime( 7923): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/AndroidRuntime( 7923): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.apparence.camerawesome.CameraPreview.setMainHandler(android.os.Handler)' on a null object reference E/AndroidRuntime( 7923): at com.apparence.camerawesome.CamerawesomePlugin.onDetachedFromActivityForConfigChanges(CamerawesomePlugin.java:521) E/AndroidRuntime( 7923): at io.flutter.embedding.engine.FlutterEnginePluginRegistry.detachFromActivityForConfigChanges(FlutterEnginePluginRegistry.java:328) E/AndroidRuntime( 7923): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:510) E/AndroidRuntime( 7923): at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:577) E/AndroidRuntime( 7923): at android.app.Activity.performDestroy(Activity.java:8245) E/AndroidRuntime( 7923): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344) E/AndroidRuntime( 7923): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5090) E/AndroidRuntime( 7923): ... 16 more

    About your device

    Android - Pixel 4a, And various emulators. Every Android I have tested has same result | Brand | Model | OS | | ------- | ----------- | --------- | | Apple | iPhone X | 13.6.1 |

    bug android 
    opened by ak-cloud 12
  • iOS Imagestream: Manage list of planes

    iOS Imagestream: Manage list of planes

    ImageStreamBuilder iOS

    Hi,

    I'm trying to implement a QR code reader with CameraAwesome. On Android, it works just fine. On iOS it doesn't work.

    In details:

    In imageStreamBuilder, I get the streamSubscription and I start scanner calling the function "onData". In this case I convert the data given by the stream in a File and then I use BarcodeDetector (Google ML kit).

    I get the following error:

    021-01-07 19:00:58.055465+0100 Runner[2147:9132611] *** Terminating app due to uncaught exception 'FIRInvalidImage', reason: 'Input image must not be nil.' *** First throw call stack: (0x18a51d86c 0x19f48cc50 0x18a4164a4 0x1012e9934 0x101503624 0x1015033a0 0x101502d84 0x101502994 0x103da94e8 0x103568178 0x1038429ec 0x10357170c 0x103573e38 0x18a499fa0 0x18a499ba0 0x18a498ffc 0x18a492ee4 0x18a49221c 0x1a1f96784 0x18ced0fe0 0x18ced6854 0x100d646e0 0x18a1526b0) *** Terminating app due to uncaught exception 'FIRInvalidImage', reason: 'Input image must not be nil.' terminating with uncaught exception of type NSException libc++abi.dylib: terminating with uncaught exception of type NSException

    Since it works smoothly in Android, I think there is a problem with iOS. The problem can be reproduced with the following code:

    
    CameraAwesome(
                        sensor: _sensor,
                        captureMode: _captureMode,
                        photoSize: _photoSize,
                        selectDefaultSize: (List<Size> availableSizes) =>
                            Size(1920, 1080),
                        imagesStreamBuilder: (Stream<Uint8List> imageStream) {
                          // ignore: cancel_subscriptions
                          setState(() {
                            this.cameraMainStream = imageStream;
                          });
    
                          StreamSubscription<Uint8List> streamSubscription =
                              imageStream.listen((Uint8List imageData) {});
    
                          setState(() {
                            this.cameraStream = streamSubscription;
                          });
    
                          streamSubscription.onData((data) async {
                            if (data == null) return;
                            if (skipFrames) { //used to low the overhead. Not necessary to reproduce the problem
                              return;
                            }
    
                            skipFrame(true);
    
                            final path = join(
                              (await getTemporaryDirectory()).path,
                              '${DateTime.now()}.png',
                            );
                            debugPrint('3');
                            File file = File(path);
                            file.writeAsBytesSync(data);
                            await file.writeAsBytes(data);
                            //File file = File.fromRawPath(data);
                            if (file == null) {
                              debugPrint('-------> NULL');
                            }
                            if (await file.exists()) {
                              debugPrint('exists');
                            }
    
                            //File file = File.fromRawPath(data);
                            try {
                              File fileCopy = File(path);
                              FirebaseVisionImage visionImage =
                                  FirebaseVisionImage.fromFile(fileCopy);
                              if (visionImage == null) {
                                debugPrint('-------> NULL');
                              }
    
                              String result =
                                  await QrProvider.detectQR(visionImage); //this calls BarcodeDetector.detectInImage(image);
                             
                            } catch (e) {
                              debugPrint(e);
                            }
    
                            skipFrame(false);
                          });
                        },
                        onCameraStarted: () {
                          skipFrame(false);
                        },
                      )
    

    I don't think it is the way I'm handling the data but probably you know it better. Can you help me with this problem? Thank you in advance!

    bug iOS priority 1 
    opened by stefanodecillis 11
  • Can not take second picture on Sony Xperia X

    Can not take second picture on Sony Xperia X

    Steps to Reproduce

    Take a picture, then try to take another picture.

    Expected results

    It should be possible to take multiple pictures.

    Actual results

    Taking the first picture works ok. When I try to take another picture the PictureController.takePicture() call never returns. Interestingly, if I press the zoom-in button after that the picture is taken.

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Sony | Xperia X | Android 8.0 |

    bug 
    opened by Max-Might 10
  • Front camera crashes

    Front camera crashes

    Steps to Reproduce

    Switching to front camera crashed the app

    if (_sensor.value == Sensors.FRONT) { _sensor.value = Sensors.BACK; } else { _sensor.value = Sensors.FRONT; }

    Actual results

    uid: 10416 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x660 Cause: null pointer dereference x0 0000000000000660 x1 0000007e7e053cc0 x2 0000000000000000 x3 0000007ee7be7dff x4 0000007e7e053ca8 x5 000000000000004a x6 4055404906ff5140 x7 7f7f7f7f7f7f7f7f x8 0000000000000001 x9 71e2bf4945037b8f x10 0000000000430000 x11 000000000000001e x12 0000007ee7c63224 x13 0000007ee7c6326c x14 0000007ee7c632cc x15 0000000000000000 x16 0000007f6a7d9530 x17 0000007f6d41b760 x18 0000007e77570000 x19 0000000000000660 x20 0000000000000000 x21 0000007f6ca3b0a0 x22 0000007f6ca38028 x23 0000007ee6df629a x24 0000000000000004 x25 0000007e7e057020 x26 0000007edbc62cb0 x27 0000000000000001 x28 0000000000000000 x29 0000007e7e053d60 sp 0000007e7e053d40 lr 0000007f6a50df84 pc 0000007f6d41b760 backtrace: #00 pc 00000000000d7760 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock) (BuildId: 084c8a81b8c78e19cd9a1ff6208e77cf) #01 pc 000000000038cf80 /system/lib64/libhwui.so (android::SurfaceTexture::updateTexImage()+60) (BuildId: 0e7f75c3766e031530e154cd7d0a25e7) #02 pc 0000000000172d90 /system/lib64/libandroid_runtime.so (android::SurfaceTexture_updateTexImage(_JNIEnv*, _jobject*)+84) (BuildId: e3e429bb025cd55af3bf8324d4a5a8c7) #03 pc 0000000000aa2a9c /system/framework/arm64/boot-framework.oat (art_jni_trampoline+124) (BuildId: 1be0836f4fd69b30e55a3dd02927bd44ccc064b8) #04 pc 0000000000137334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5) #05 pc 0000000000145fec /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5) #06 pc 00000000002e37d0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: b8abc9218340860606bcffe3818ec9c5) #07 pc 00000000002dea30 /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892) (BuildId: b8abc9218340860606bcffe3818ec9c5) #08 pc 00000000005a3294 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+424) (BuildId: b8abc9218340860606bcffe3818ec9c5) #09 pc 0000000000131914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: b8abc9218340860606bcffe3818ec9c5) #10 pc 00000000003b3624 /system/framework/framework.jar (android.graphics.SurfaceTexture.updateTexImage) #11 pc 00000000005a122c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352) (BuildId: b8abc9218340860606bcffe3818ec9c5) #12 pc 0000000000131814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: b8abc9218340860606bcffe3818ec9c5) #13 pc 00000000003c984a [anon:dalvik-classes.dex extracted in memory from /data/app/com.camera.bluehour-RxBaXNy7y30bjN9ZQX_VqA==/base.apk] (io.flutter.embedding.engine.renderer.SurfaceTextureWrapper.updateTexImage+14) #14 pc 00000000002b4ae4 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.17460956533834400288+240) (BuildId: b8abc9218340860606bcffe3818ec9c5) #15 pc 00000000005924d4 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032) (BuildId: b8abc9218340860606bcffe3818ec9c5) #16 pc 0000000000140468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b8abc9218340860606bcffe3818ec9c5) #17 pc 0000000000137334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: b8abc9218340860606bcffe3818ec9c5) #18 pc 0000000000145fec /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: b8abc9218340860606bcffe3818ec9c5) #19 pc 00000000004b0ed8 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: b8abc9218340860606bcffe3818ec9c5) #20 pc 00000000004b2324 /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+424) (BuildId: b8abc9218340860606bcffe3818ec9c5) #21 pc 00000000003981b8 /apex/com.android.runtime/lib64/libart.so (art::JNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+628) (BuildId: b8abc9218340860606bcffe3818ec9c5) #22 pc 000000000036cc50 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+2368) (BuildId: b8abc9218340860606bcffe3818ec9c5) #23 pc 000000000035af30 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+72) (BuildId: b8abc9218340860606bcffe3818ec9c5)

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Redmi | k20 Pro | MIUI 12.0.4, Android 10 |

    help wanted android 
    opened by sjayadeep 9
  •  PlatformException(FAILED_TO_CHECK_PERMISSIONS, , NULL_ACTIVITY, null)

    PlatformException(FAILED_TO_CHECK_PERMISSIONS, , NULL_ACTIVITY, null)

    Hello, my Manifest looks like this on Android but I get a Permission error any ideas?

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    
     
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Vote"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
    
    android 
    opened by enviro-apps 8
  • Exceptions when opening camera [Android 7 / Legacy mode]

    Exceptions when opening camera [Android 7 / Legacy mode]

    Steps to Reproduce

    Trying the plugin on Redmi 4A. When opening the camera I'm getting this exception first PlatformException (PlatformException(MUST_CALL_INIT, , , null))

    Then, after pressing Continue this exception shows PlatformException (PlatformException(TEXTURE_NOT_FOUND, cannot find texture, , null))

    After pressing Continue one more time, camera finally opens.

    > import 'package:flutter/material.dart';
    > import 'package:camerawesome/camerawesome_plugin.dart';
    > 
    > // A screen that allows users to take a picture using a given camera.
    > class TakePictureScreen extends StatefulWidget {
    >   @override
    >   TakePictureScreenState createState() => TakePictureScreenState();
    > }
    > 
    > class TakePictureScreenState extends State<TakePictureScreen> {
    >   ValueNotifier<CameraFlashes> _switchFlash = ValueNotifier(CameraFlashes.NONE);
    >   ValueNotifier<Sensors> _sensor = ValueNotifier(Sensors.BACK);
    >   ValueNotifier<Size> _photoSize = ValueNotifier(null);
    >   ValueNotifier<double> _zoom = ValueNotifier(null);
    >   double _previousScale;
    >   List<Size> availableSizes;
    > 
    >   // Controller
    >   PictureController _pictureController = new PictureController();
    > 
    >   // [...]
    > 
    >   @override
    >   void initState() {
    >     super.initState();
    >   }
    > 
    >   @override
    >   void dispose() {
    >     super.dispose();
    >   }
    > 
    >   @override
    >   Widget build(BuildContext context) {
    >     return CameraAwesome(
    >       onPermissionsResult: _onPermissionsResult,
    >       selectDefaultSize: (availableSizes) {
    >         this.availableSizes = availableSizes;
    >         return availableSizes[0];
    >       },
    >       photoSize: _photoSize,
    >       sensor: _sensor,
    >       switchFlashMode: _switchFlash,
    >       zoom: _zoom,
    >       //onOrientationChanged: _onOrientationChange,
    >       // imagesStreamBuilder: (imageStream) {
    >       //   /// listen for images preview stream
    >       //   /// you can use it to process AI recognition or anything else...
    >       //   print("-- init CamerAwesome images stream");
    >       //   setState(() {
    >       //     previewStream = imageStream;
    >       //   });
    >       // },
    >       onCameraStarted: () {
    >         // camera started here -- do your after start stuff
    >       },
    >     );
    >   }
    > 
    >   _onPermissionsResult(bool granted) {
    >     if (!granted) {
    >       AlertDialog alert = AlertDialog(
    >         title: Text('Error'),
    >         content: Text(
    >             'It seems you doesn\'t authorized some permissions. Please check on your settings and try again.'),
    >         actions: [
    >           FlatButton(
    >             child: Text('OK'),
    >             onPressed: () => Navigator.of(context).pop(),
    >           ),
    >         ],
    >       );
    > 
    >       // show the dialog
    >       showDialog(
    >         context: context,
    >         builder: (BuildContext context) {
    >           return alert;
    >         },
    >       );
    >     } else {
    >       setState(() {});
    >       print("granted");
    >     }
    >   }
    > }
    

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Android | Redmi 4A | 7.1.2 |

    bug android 
    opened by UlanNurmatov 8
  • [CRASH] Error While Navigation to another route with hero and camera

    [CRASH] Error While Navigation to another route with hero and camera

    Awsome Plugin 😄 , I just switched from the official camera plugin in my app to try this plugin, but ... there is an Issue:

    Steps to Reproduce

    I have a custom gallery UI and the first item in it is a small camera when the user clicks on it, switches to a full view with the camera (also custom UI) Here is a screenshot of the UI:

    image

    When I click on the camera (the first item) it switches to another route with Hero animation but it throws a lot of errors and event when I get back it crashes the app here is a log:

    View Log

    [GETX] GOING TO ROUTE /camera
    [GETX] "CameraController" has been initialized
    D/com.apparence.camerawesome.CamerawesomePlugin( 3672): _handleCheckPermissions: 
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    W/chat.owl.app( 3672): type=1400 audit(0.0:275089): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=19220 scontext=u:r:untrusted_app:s0:c233,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
    D/com.apparence.camerawesome.CamerawesomePlugin( 3672): _handleCheckPermissions: 
    E/flutter ( 3672): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: A ValueNotifier<Size> was used after being disposed.
    E/flutter ( 3672): Once you have called dispose() on a ValueNotifier<Size>, it can no longer be used.
    E/flutter ( 3672): #0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:117:9)
    E/flutter ( 3672): #1      ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:123:6)
    E/flutter ( 3672): #2      ChangeNotifier.addListener (package:flutter/src/foundation/change_notifier.dart:153:12)
    E/flutter ( 3672): #3      _CameraAwesomeState._initAndroidPhotoSize (package:camerawesome/camerapreview.dart:248:30)
    E/flutter ( 3672): #4      _CameraAwesomeState.initPlatformState (package:camerawesome/camerapreview.dart:160:5)
    E/flutter ( 3672): <asynchronous suspension>
    E/flutter ( 3672): #5      _CameraAwesomeState.initState (package:camerawesome/camerapreview.dart:121:5)
    E/flutter ( 3672): #6      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58)
    E/flutter ( 3672): #7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #8      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #9      Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #10     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #11     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
    E/flutter ( 3672): #12     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #13     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #14     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4791:11)
    E/flutter ( 3672): #15     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #16     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #17     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #18     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14)
    E/flutter ( 3672): #19     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #20     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32)
    E/flutter ( 3672): #21     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #22     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #23     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #24     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #25     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #26     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #27     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #28     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #29     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #30     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #31     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #32     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #33     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #34     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #35     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #36     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #37     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #38     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #40     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #41     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #42     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #43     ComponentElement._firstBuild (package:flutter/src/widgets/framewo
    W/chat.owl.app( 3672): type=1400 audit(0.0:275092): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=19220 scontext=u:r:untrusted_app:s0:c233,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    D/com.apparence.camerawesome.CamerawesomePlugin( 3672): _handleCheckPermissions: 
    E/flutter ( 3672): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: A ValueNotifier<Size> was used after being disposed.
    E/flutter ( 3672): Once you have called dispose() on a ValueNotifier<Size>, it can no longer be used.
    E/flutter ( 3672): #0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:117:9)
    E/flutter ( 3672): #1      ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:123:6)
    E/flutter ( 3672): #2      ChangeNotifier.addListener (package:flutter/src/foundation/change_notifier.dart:153:12)
    E/flutter ( 3672): #3      _CameraAwesomeState._initAndroidPhotoSize (package:camerawesome/camerapreview.dart:248:30)
    E/flutter ( 3672): #4      _CameraAwesomeState.initPlatformState (package:camerawesome/camerapreview.dart:160:5)
    E/flutter ( 3672): <asynchronous suspension>
    E/flutter ( 3672): #5      _CameraAwesomeState.initState (package:camerawesome/camerapreview.dart:121:5)
    E/flutter ( 3672): #6      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58)
    E/flutter ( 3672): #7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #8      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #9      Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #10     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #11     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
    E/flutter ( 3672): #12     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #13     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #14     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4791:11)
    E/flutter ( 3672): #15     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #16     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #17     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #18     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14)
    E/flutter ( 3672): #19     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #20     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32)
    E/flutter ( 3672): #21     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #22     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #23     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #24     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #25     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #26     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #27     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #28     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #29     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #30     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #31     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #32     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #33     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #34     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #35     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #36     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #37     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
    E/flutter ( 3672): #38     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
    E/flutter ( 3672): #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
    E/flutter ( 3672): #40     Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
    E/flutter ( 3672): #41     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
    E/flutter ( 3672): #42     Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
    E/flutter ( 3672): #43     ComponentElement._firstBuild (package:flutter/src/widgets/framewo
    W/chat.owl.app( 3672): type=1400 audit(0.0:275093): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=19220 scontext=u:r:untrusted_app:s0:c233,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    E/libc    ( 3672): Access denied finding property "persist.vendor.camera.privapp.list"
    W/chat.owl.app( 3672): type=1400 audit(0.0:275094): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=19220 scontext=u:r:untrusted_app:s0:c233,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    W/Binder:3672_6( 3672): type=1400 audit(0.0:275097): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=19220 scontext=u:r:untrusted_app:s0:c233,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
    
    <snippit>
    [GETX] CLOSE TO ROUTE /camera
    D/com.apparence.camerawesome.CamerawesomePlugin( 3672): _handleCheckPermissions: 
    E/com.apparence.camerawesome.CameraStateManager( 3672): close camera session: failed
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    D/com.apparence.camerawesome.CamerawesomePlugin( 3672): _handleCheckPermissions: 
    [GETX] "CameraController" onClose() called
    [GETX] "CameraController" deleted from memory
    E/flutter ( 3672): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: A ValueNotifier<Size> was used after being disposed.
    E/flutter ( 3672): Once you have called dispose() on a ValueNotifier<Size>, it can no longer be used.
    E/flutter ( 3672): #0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:117:9)
    E/flutter ( 3672): #1      ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:123:6)
    E/flutter ( 3672): #2      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:217:12)
    E/flutter ( 3672): #3      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:292:5)
    E/flutter ( 3672): #4      _CameraAwesomeState._initPhotoSize.<anonymous closure> (package:camerawesome/camerapreview.dart:264:32)
    E/flutter ( 3672): #5      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:226:25)
    E/flutter ( 3672): #6      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:292:5)
    E/flutter ( 3672): #7      _CameraAwesomeState.initPlatformState (package:camerawesome/camerapreview.dart:164:24)
    E/flutter ( 3672): #8      _rootRunUnary (dart:async/zone.dart:1198:47)
    E/flutter ( 3672): #9      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    E/flutter ( 3672): #10     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
    E/flutter ( 3672): #11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
    E/flutter ( 3672): #12     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
    E/flutter ( 3672): #13     Future._completeWithValue (dart:async/future_impl.dart:529:5)
    E/flutter ( 3672): #14     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
    E/flutter ( 3672): #15     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
    E/flutter ( 3672): #16     CamerawesomePlugin.getSizes (package:camerawesome/camerawesome_plugin.dart)
    E/flutter ( 3672): #17     _rootRunUnary (dart:async/zone.dart:1198:47)
    E/flutter ( 3672): #18     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    E/flutter ( 3672): #19     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
    E/flutter ( 3672): #20     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
    E/flutter ( 3672): #21     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
    E/flutter ( 3672): #22     Future._completeWithValue (dart:async/future_impl.dart:529:5)
    E/flutter ( 3672): #23     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
    E/flutter ( 3672): #24     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
    E/flutter ( 3672): #25     MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart)
    E/flutter ( 3672): #26     _rootRunUnary (dart:async/zone.dart:1198:47)
    E/flutter ( 3672): #27     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    E/flutter ( 3672): #28     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
    E/flutter ( 3672): #29     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
    E/flutter ( 3672): #30     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
    E/flutter ( 3672): #31     Future._completeWithValue (dart:async/future_impl.dart:529:5)
    E/flutter ( 3672): #32     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
    E/flutter ( 3672): #33     _rootRun (dart:async/zone.dart:1190:13)
    E/flutter ( 3672): #34     _CustomZone.run (dart:async/zone.dart:1093:19)
    E/flutter ( 3672): #35     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    E/flutter ( 3672): #36     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
    E/flutter ( 3672): #37     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    E/flutter ( 3672): #38     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    E/flutter ( 3672): 
    E/libc    ( 3672): Access denied finding property "persist.vendor.camera.privapp.list"
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    E/libc    ( 3672): Access denied finding property "vendor.camera.aux.packagelist"
    D/AndroidRuntime( 3672): Shutting down VM
    E/AndroidRuntime( 3672): FATAL EXCEPTION: main
    E/AndroidRuntime( 3672): Process: chat.owl.app, PID: 3672
    E/AndroidRuntime( 3672): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.util.Size.getWidth()' on a null object reference
    E/AndroidRuntime( 3672): 	at com.apparence.camerawesome.CameraPicture.refresh(CameraPicture.java:74)
    E/AndroidRuntime( 3672): 	at com.apparence.camerawesome.CameraStateManager.onOpened(CameraStateManager.java:133)
    E/AndroidRuntime( 3672): 	at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:151)
    E/AndroidRuntime( 3672): 	at android.os.Handler.handleCallback(Handler.java:883)
    E/AndroidRuntime( 3672): 	at android.os.Handler.dispatchMessage(Handler.java:100)
    E/AndroidRuntime( 3672): 	at android.os.Looper.loop(Looper.java:214)
    E/AndroidRuntime( 3672): 	at android.app.ActivityThread.main(ActivityThread.java:7397)
    E/AndroidRuntime( 3672): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime( 3672): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    E/AndroidRuntime( 3672): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
    I/Process ( 3672): Sending signal. PID: 3672 SIG: 9
    Lost connection to device.
    Failed to send request: {"jsonrpc":"2.0","id":"126","method":"resume","params":{"isolateId":"isolates/764243394252463"}}
    
    

    And here is how I use it:

    in the gallery view:

    ...
    Hero(
      tag: 'camera',
      child: GestureDetector(
        onTap: () async {
          final result = await Get.toNamed(Routes.camera);
          if (result != null) {
            // ...
          }
        },
        child: Stack(
          alignment: Alignment.center,
          children: [
            CameraAwesome(
              testMode: false,
              sensor: controller.sensor,
              selectDefaultSize: (List<Size> availableSizes) =>
                  availableSizes.first ?? Size(1920, 1080),
              onCameraStarted: () {},
              photoSize: ValueNotifier(null),
              switchFlashMode: controller.flash,
              fitted: false,
              orientation: DeviceOrientation.portraitUp,
            ),
            const Icon(
              Icons.camera_alt,
              color: Colors.white,
              size: 42,
            ),
          ],
        ),
      ),
    )
    ...
    

    in the Camera View

    ...
    CameraAwesome(
      testMode: false,
      sensor: controller.sensor,
      selectDefaultSize: (List<Size> availableSizes) =>
          availableSizes.first ?? Size(1920, 1080),
      onCameraStarted: () {},
      photoSize: controller.picSize,
      switchFlashMode: controller.flash,
      fitted: false,
      orientation: DeviceOrientation.portraitUp,
    )
    ...
    

    btw, the controller here is a normal class that holds the state and the ValueNotifiers and only got disposed/deleted when the controller is fully removed from the screen and in my case, the Galler Controller is not removed, it just got overlayed with another route (The Camera View).

    Expected results

    Switching between routes should work with any issues when there is a camera in it.

    Actual results

    App Crash!

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Xiaomi | Mi A3 | Android 10|

    bug 
    opened by shekohex 8
  • app crashing when starting video on iOS

    app crashing when starting video on iOS

    Hello!

    Steps to Reproduce

    I copied your _recordVideo method pretty much verbatim.

      _recordVideo() async {
        if (_isRecordingVideo) {
          await _videoController.stopRecordingVideo();
    
          _isRecordingVideo = false;
          setState(() {});
        } else {
          final extDir = await getTemporaryDirectory();
          final testDir =
              await Directory('${extDir.path}/test').create(recursive: true);
          final filePath = '${testDir.path}/video_test.mp4';
    
          await _videoController.recordVideo(filePath);
    
          _isRecordingVideo = true;
          setState(() {});
        }
      }
    

    Expected results

    Video should work.

    Actual results

    App crashes and I see the following in the XCode console:

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported value for standard codec'

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Apple | iPhone 12 Pro | 14.2.1 |

    bug 
    opened by jamesdixon 7
  • Wide Angle & Zoom Lens Switching?

    Wide Angle & Zoom Lens Switching?

    Proposal

    Include the option to cycle through all available camera/lenses.

    iPhone Pro has 3 different lenses / cameras. I recall using a Flutter app/package that allowed you to cycle through all the lenses which included the wide-angle the regular as well as the zoom lens. It was a while back but I think it was just a matter of allowing 4 cameras in the list rather than 2.

    Any plans for this?

    Thanks

    opened by jtkeyva 1
  • 📝 Add AI docs and improve AI examples

    📝 Add AI docs and improve AI examples

    Description

    • Improve AI examples readability
    • Add detailed doc on AI examples with MLKit

    Checklist

    Before creating any Pull Request, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).

    • [x] 📕 I read the Contributing page.
    • [x] 🤝 I match the actual coding style.
    • [x] ✅ I ran flutter analyze without any issues.

    Breaking Change

    • [ ] 🛠 My feature contain breaking change.

    If your feature break something, please detail it

    opened by apalala-dev 0
  • Don't include permissions automatically

    Don't include permissions automatically

    Proposal

    When showing the camera preview, there are a couple permissions that get automatically requested, even if they're not used:

    • Microphone: we're only interested in the camera for photos, so even if I set enableAudio: false, the permission is added to the Manifest and automatically requested.
    • Location: we're not interested in saving exif data on images, but still the location permission dialog appears when starting the camera.

    The list of permissions shouldn't be included by default in the manifest, apart from the camera/media permission. Since microphone and location is optional, make the permissions in the manifest also opt-in (the dev will have to manually add it to the manifest). This will prevent having to add docs to Play Store on why there's a location/microphone permission

    enhancement 
    opened by Zazo032 1
  • Switching flash mode triggers an internal error

    Switching flash mode triggers an internal error

    Steps to Reproduce

    Call state.sensorConfig.switchCameraFlash

    Expected results

    FlashMode iterates to the next one

    Actual results

    I/flutter (12799): ----------------FIREBASE CRASHLYTICS----------------
    I/flutter (12799): Bad state: Cannot add new events after calling close
    I/flutter (12799): #0      _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24)
    I/flutter (12799): #1      Subject._add (package:rxdart/src/subjects/subject.dart:151:17)
    I/flutter (12799): #2      Subject.add (package:rxdart/src/subjects/subject.dart:141:5)
    I/flutter (12799): #3      _StreamSinkWrapper.add (package:rxdart/src/subjects/subject.dart:215:13)
    I/flutter (12799): #4      SensorConfig.setFlashMode (package:camerawesome/src/orchestrator/sensor_config.dart:76:31)
    I/flutter (12799): <asynchronous suspension>
    I/flutter (12799): ----------------------------------------------------
    I/flutter (12799): Bad state: Cannot add new events after calling close
    I/flutter (12799): #0      _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24)
    I/flutter (12799): #1      Subject._add (package:rxdart/src/subjects/subject.dart:151:17)
    I/flutter (12799): #2      Subject.add (package:rxdart/src/subjects/subject.dart:141:5)
    I/flutter (12799): #3      _StreamSinkWrapper.add (package:rxdart/src/subjects/subject.dart:215:13)
    I/flutter (12799): #4      SensorConfig.setFlashMode (package:camerawesome/src/orchestrator/sensor_config.dart:76:31)
    I/flutter (12799): <asynchronous suspension>
    

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Samsung | A21s | 12 |

    bug android 
    opened by Zazo032 3
  • README typos?

    README typos?

    image

    Hey, nice project. The image in the README appears to have a few typos.

    "camerAwesome" -> "cameraAwesome" "beautifull" -> "beautiful"

    There are other places in the README where "camerAwesome" is used and other places where "cameraAwesome" is used, etc. I believe it should be the latter.

    image

    documentation 
    opened by Correct-Syntax 1
  • Front camera and back camera cannot work together

    Front camera and back camera cannot work together

    Front camera and back camera cannot work together Like bereal thumb_Screen Shot 2022-10-08 at 19 35 36

    Steps to Reproduce

    Describe how to reproduce the error

    Expected results

    What it should be

    Actual results

    only front or only back. its not working together

    About your device

    | Brand | Model | OS | | ------- | ----------- | --------- | | Apple | iPhone X | 13.6.1 |

    enhancement android iOS 
    opened by dvird 3
Releases(1.0.0-rc2)
  • 1.0.0-rc2(Jan 3, 2023)

    • iOS analysis image stream
    • Fix camera preview size when switching sensors
    • Fix aspect ratio portrait for iOS
    • E2E tests
    • 1:1 aspect ratio
    • Preview fit can be choosed
    • many small fixes
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0-rc1(Dec 15, 2022)

  • 1.0.0-preview(Nov 22, 2022)

    • complete rework of flutter plugin
    • built in interface
    • customize your interface and use provided widgets if you want
    • ability to listen every configuration
    • handle aspect ratio
    • control flash mode
    • video mode
    • listen orientation
    • preview of last media

    Android

    • now use the AndroidX camera implementation
    • now using Kotlin
    • video mode

    iOS

    • migrated for the new flutter plugin
    • aspect ratio
    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Dec 17, 2020)

    0.2.1

    • [iOS] image stream available to use MLkit or other image live processing
    • [iOS] code refactoring

    0.2.0

    • [iOS] video recording support
    • [iOS] thread and perf enhancements
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2+1(Nov 19, 2020)

    • [Android] onDetachedFromActivity : fix stopping the camera should be only done if camera has been started
    • listen native Orientation should be canceled correctly on dispose CameraAwesomeState
    • unlock focus now restart session correctly after taking a photo
    • takePicture listener now cannot send result more than one time
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Oct 23, 2020)

  • 0.1.0(Oct 19, 2020)

Owner
Apparence.io
App development studio
Apparence.io
Collection of extension function of just_audio package for auto-handle caching

just_audio_cache Collection of extension function of just_audio package for auto-handle caching audio files How to use The premise is you already have

Yoda 10 Aug 24, 2022
Flutter WeChat Camera Picker

Flutter WeChat Camera Picker Language: English | 中文简体 A camera picker which is an extension for wechat_assets_picker. Based on camera for camera funct

null 1 Nov 14, 2021
Flutter camera demo

Flutter Camera Demo A full-fledged camera app built with Flutter using the camera package. You can even add custom features to this app and customize

Souvik Biswas 60 Dec 30, 2022
A plugins pick Image & camera for Flutter

christian_picker_image Flutter plugin that allows you to upload multi image picker on iOS & Android. Getting Started ChristianImagePicker is an all-in

nguyen phuc nguyen 24 Apr 29, 2022
Image Picker Load image from camera and gallery

image_choose A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

MD TAMIM ISLAM KHAN 2 Sep 12, 2022
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)

speech_recognition A flutter plugin to use the speech recognition iOS10+ / Android 4.1+ Basic Example Sytody, speech to todo app Installation Depend o

Erick Ghaumez 331 Dec 19, 2022
Flutter plugin for selecting multiple images from the Android and iOS image library

Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotating, cropping, adding sticker/filters.

Weta Vietnam 91 Dec 19, 2022
A Flutter audio plugin (Swift/Java) to play remote or local audio files on iOS / Android / MacOS and Web

AudioPlayer A Flutter audio plugin (Swift/Java) to play remote or local audio files on iOS / Android / MacOS and Web. Online demo Features Android / i

Erick Ghaumez 489 Dec 18, 2022
A Flutter media player plugin for iOS and android based on ijkplayer

Flutter media player plugin for android/iOS based on ijkplayer.

于飞白呀 1.4k Jan 4, 2023
Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications

?? assets_audio_player ?? Play music/audio stored in assets files (simultaneously) directly from Flutter (android / ios / web / macos). You can also u

Florent CHAMPIGNY 651 Dec 24, 2022
A flutter package for iOS and Android for applying filter to an image

Photo Filters package for flutter A flutter package for iOS and Android for applying filter to an image. A set of preset filters are also available. Y

Ansh rathod 1 Oct 26, 2021
A Flutter package for both android and iOS which provides Audio recorder

social_media_recorder A Flutter package for both android and iOS which provides

subhikhalifeh 16 Dec 29, 2022
Audio classification Tflite package for flutter (iOS & Android).

Audio classification Tflite package for flutter (iOS & Android). Can also support Google Teachable Machine models.

Michael Nguyen 47 Dec 1, 2022
Tiwee - An IPTV player developed for android/ios devices with flutter

Tiwee An IPTV player developed for android/ios devices with flutter you can watc

Hossein 58 Dec 27, 2022
Apps For streaming audio via url (Android, iOS & Web ). Developed with Dart & Flutter ❤

Flutter Sleep App (Dicoding Submission : Learn to Make Flutter Apps for Beginners) Stream Great collection of high-definition sounds that can be mixed

Utrodus Said Al Baqi 13 Nov 29, 2022
An ipod classic for iOS/Android, built with Flutter

Retro aims to bring back the iPod Classic experience to iOS and Android. I originally started working on it nearly 2 years ago and released it as a TestFlight beta (because Apple wouldn't allow it on the App Store) and have been maintaining it myself since.

Retro Music 69 Jan 3, 2023
Just_audio: a feature-rich audio player for Android, iOS, macOS and web

just_audio just_audio is a feature-rich audio player for Android, iOS, macOS and web. Mixing and matching audio plugins The flutter plugin ecosystem c

Ensar Yusuf Yılmaz 2 Jun 28, 2022
Automatically generates native code for adding splash screens in Android and iOS.

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.

Jon Hanson 949 Jan 2, 2023