Can't capture images with flasher mode Torch
I'm developing a camera application in android. there is an option for turn on-off the flashlight. when the flashlight is turn on, it should be light continuously until the user turns off the light.
image capturing is not working when the user turns on the flashlight and it continuously shows the progress bar. while progress is showing and the user turns off the light, then the capture become complete successfully. following is my code for turn on-off the flashlight.
this happens only Samsung S6 edge and few other Samsung devices.
public void turnOnOffFlashLight()
{
try {
// Change some capture settings
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
if(!isFlashOn) {
isFlashOn=true;
flashButton.setImageResource(R.drawable.icflashon);
mPreviewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_TORCH);
}else{
isFlashOn=false;
flashButton.setImageResource(R.drawable.icflashoff);
mPreviewRequestBuilder.set(CaptureRequest.FLASH_MODE, CameraMetadata.FLASH_MODE_OFF);
}
// Build new request (we can't just edit existing one, as it is immutable)
mPreviewRequest = mPreviewRequestBuilder.build();
// Set new repeating request with our changed one
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
链接地址: http://www.djcxy.com/p/90946.html
上一篇: 数据真的支持嵌套的网址?
下一篇: 无法使用闪光灯模式拍摄图像