RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 408 forks source link

Flash behavior #99

Open IceBullet opened 7 years ago

IceBullet commented 7 years ago

I faced a problem when changing the flash state. If the previous flash state was TORCH, the flash is still active when switching to the FLASH_AUTO or FLASH_ON state. It turns off only if mode was changed to FLASH_OFF.

dmitry-zaitsev commented 7 years ago

Can't reproduce it on S7 Edge, but I can totally imagine that it is possible on other devices.

Could you please provide some more information/code:

  1. How do you initialize the Fotoapparat.
  2. How do you update the flash mode.
  3. Which device are you using (name and value of Build.BOARD)?
IceBullet commented 7 years ago
  1. Initialization Called in onCreate(...) method of activity if necessary permissions was granted or in method onRequestPermissionsResult(...). FotoapparatBuilder fb = Fotoapparat.with(this) .into(cameraView) .previewScaleType(ScaleType.CENTER_CROP) .lensPosition(LensPositionSelectors.back()) .photoSize(SizeSelectors.biggestSize()); fotoapparat = fb.build();

  2. Update Called in onOptionsItemSelected(...). fotoapparat.updateParameters(UpdateRequest.builder().flash(FlashSelectors.autoFlash()).build());

  3. Device Huawei nexus 6p, Android 8. Build.BOARD - angler

Diolor commented 6 years ago

Can reproduce on pixel 2. This is stupid...

/**
         * Flash will be fired automatically when required. The flash may be fired
         * during preview, auto-focus, or snapshot depending on the driver.
         */

I guess we fall under may be fired during preview here...

Native pixel camera has off,auto,on. Looks like ok UX. We could make a fix here and apply off before torch but I find it minor

Raenar4k commented 6 years ago

Have same issue, can be reproduced on Motorola Nexus 6 , android 7.1.1

andreas-lorenz commented 6 years ago

Same on Nexus 5, Android 6.0.1

ErAmrit commented 5 years ago

@Diolor The same issue is still present on "io.fotoapparat:fotoapparat:2.7.0" can you please fix it asap. Note: Flashlight should be off when tapping for focus Tested device: Samsung J6, Honor 9 Light Android Os Version Above 21