ricnaaru / adv_camera

Advanced Camera for Flutter
BSD 3-Clause "New" or "Revised" License
54 stars 35 forks source link

Flash doesn't work. #53

Closed margorski closed 3 years ago

margorski commented 3 years ago

Hello, Flash functionality doesn't work in any configuration for me with adv_camera. I tested setting flash type in different configuration and in every configuration nothing happens.

Tried by setting flashtype to FlashType.torch on initialization:

return Positioned(
        top: 0,
        left: 0,
        bottom: 0,
        right: 0,
        child: Center(
            child: AdvCamera(
              initialCameraType: CameraType.rear,
              onCameraCreated: _onCameraCreated,
              onImageCaptured: _onImageCaptured,
              flashType: FlashType.torch,
        )));

Tried to iterate over flash types by clicking on screen button

CameraOptionButton(
        icon: _getFlashIcon(),
        onTapCallback: () {
          FlashType newFlashType;
          switch (this.flashType) {
            case FlashType.off:
              newFlashType = FlashType.auto;
              break;
            case FlashType.auto:
              newFlashType = FlashType.on;
              break;
            case FlashType.on:
              newFlashType = FlashType.torch;
              break;
            case FlashType.torch:
              newFlashType = FlashType.off;
              break;
          }
          setState(() {
            flashType = newFlashType;
          });
          cameraController.setFlashType(FlashType.torch);
        })

Confirmed that button works and values here are changed but nothing happens with flashlight.

Expected result: Flashlight is used according to flashtype value. Result: Nothing happens, flashlight is disabled and didn't flash when photo is taken.

Tested that on Blackberry Key one and Xiaomi Mi6 (both android devices). All of other adv_camera api like switchCamera, turnOffCamera works fine. There are no errors in terminal.

Any thoughts?

shachneff commented 3 years ago

+1

ricnaaru commented 3 years ago

It's supposed to be fixed on the latest version.