为什么闪存驱动器应用程序在堆栈? CONTROL_AE_MODE_ON_ALWAYS_FLASH Camera2API [英] Why does flash drives app in stack? CONTROL_AE_MODE_ON_ALWAYS_FLASH Camera2API
问题描述
有奇怪的情况。我使用了 standard google sample camera2API
。
我需要闪光灯永久工作, 。
为了完成它,我改变了一行代码:
private void setAutoFlash(CaptureRequest.Builder requestBuilder){
if(mFlashSupported){
// requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH);
}
}
CONTROL_AE_MODE_ON_AUTO_FLASH
我已将它更改为
CONTROL_AE_MODE_ON_ALWAYS_FLASH
。
拍照按钮,相机闪烁,就是这样。应用程序进入堆栈...
我做错了什么?
>
我想出下一个:
我在三个不同的设备上尝试了tern c> Meizu MX5 , Samsung S5
和 Samsung S6
。
其中两个 Meizu MX5
, Samsung S5
可正常使用上述代码和应用程式
问题发生在 Samsung S6
,但...
方法 setAutoFlash()
在不同位置调用代码3次
-
captureStillPicture()
-
unlockFocus()
-
onConfigured()
窍门是如果我禁用 setAutoFlash()
在 captureStillPicture()
code>它是停止堆叠和闪光开始工作,但如果我尝试这种方法 Meizu MX5
, Samsung S5
flash不起作用...
最终找到解决方案
As i said method
protected final void setAutoFlash(CaptureRequest.Builder requestBuilder){
if(isFlashSupported ){
requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
}
}
在代码中的三个不同位置调用。
-
captureStillPicture()
-
unlockFocus()
-
onConfigured()
所以我在每个方法中实现本行 requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
p>
最后,我得到:
-
unlockFocus / code> - >
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_ON_AL_WAYS_FLASH); -
onConfigured()
- >
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH) code>
此方法仍保留自动设置
< =3>
captureStillPicture()
- > captureBuilder.set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
但我不知道为什么我得到这样的问题...如果有人知道原因,请让我知道。
There is weird situation. I took standard google sample camera2API
.
I need that flash is worked permanently, regardless of outside light.
In order to accomplish it i have changed one line of code:
private void setAutoFlash(CaptureRequest.Builder requestBuilder) {
if (mFlashSupported) {
// requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH);
}
}
It was CONTROL_AE_MODE_ON_AUTO_FLASH
i have changed it to CONTROL_AE_MODE_ON_ALWAYS_FLASH
.
And i have faced with issue, when i click Take picture button, camera is flashing and that is it. App goes to stack...
What am i doing wrong?
EDIT
I figure out next:
i have tryed tern on flash on three different device Meizu MX5
, Samsung S5
and Samsung S6
.
Two of them Meizu MX5
, Samsung S5
work correctly with code above and app doesn't drives in stack.
Problem occur with Samsung S6
, BUT ...
Method setAutoFlash()
invokes within code 3 times in different places
captureStillPicture()
unlockFocus()
onConfigured()
And trick is if i disable setAutoFlash()
in captureStillPicture()
for Samsung S6
it is stop stacking and flash begins to works but if i try this approach for Meizu MX5
, Samsung S5
flash doesn't works...
Eventually i found solution
As i said method
protected final void setAutoFlash(CaptureRequest.Builder requestBuilder) {
if (isFlashSupported) {
requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
}
}
invoked in three different places in code.
captureStillPicture()
unlockFocus()
onConfigured()
So i implemented this line requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
locally in each method.
Finally that i get :
unlockFocus()
->mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH);
onConfigured()
->mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH);
and for this method remained auto settings
captureStillPicture()
->captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
But i don't know the reason why i got such issue... If someone know the reason please let me know.
这篇关于为什么闪存驱动器应用程序在堆栈? CONTROL_AE_MODE_ON_ALWAYS_FLASH Camera2API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!