打开/关闭 Samsung Galaxy Ace 2.2.1 和 2.2.1 中的相机 LED/闪光灯银河标签
我正在使用 FLASH_MODE_ON
打开相机 LED 灯。
三星 Galaxy Ace 只有三种闪光模式:开、关和自动。
FLASH_MODE_TORCH
无法在 Samsung Galaxy Tab 中工作Samsung Galaxy Ace 2.2.1
这是我的代码,我如何打开相机 LED
Camera cam;
cam = Camera.open();
Parameters params = cam.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_ON);
cam.setParameters(params);
cam.startPreview();
cam.autoFocus(new AutoFocusCallback() {
public void onAutoFocus(boolean success, Camera camera) {
}
});
并通过使用将其关闭:
cam.stopPreview();
cam.release();
代码参考:在 Android 中使用相机手电筒
但问题是 LED 灯仅亮起 5 秒。然后它就会自动关闭。
谁能告诉我问题出在哪里。或者以任何方式连续打开 LED 灯,直到要求停止为止。
I am turning ON Camera LED light using FLASH_MODE_ON
.
Samsung Galaxy Ace have only three flash modes : on, off and auto.
FLASH_MODE_TORCH
not working in Samsung Galaxy Tab & Samsung Galaxy Ace 2.2.1
Here is my code how i am turning ON my Camera LED
Camera cam;
cam = Camera.open();
Parameters params = cam.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_ON);
cam.setParameters(params);
cam.startPreview();
cam.autoFocus(new AutoFocusCallback() {
public void onAutoFocus(boolean success, Camera camera) {
}
});
And turning it off by using :
cam.stopPreview();
cam.release();
Code Reference : Use camera flashlight in Android
But the problem is LED Light remains on just for 5sec. It just then turns OFF automatically.
Can anyone please tell where can be the problem. OR any way to turn ON the LED light continuously till its requested to Stop.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很快就会发布我的应用程序的新版本来支持 Galaxy ace。
您可以在此处下载:https://play.google.com/ store/apps/details?id=droid.pr.coolflashlightfree
为了解决您的问题,您应该这样做:
不要担心 FLASH_MODE_OFF,因为这会让灯保持亮着,很奇怪,但这是
事实关闭 LED 只需松开相机
I will soon released a new version of my app to support to galaxy ace.
You can download here: https://play.google.com/store/apps/details?id=droid.pr.coolflashlightfree
In order to solve your problem you should do this:
don't worry about FLASH_MODE_OFF because this will keep the light on, strange but it's true
to turn off the led just release the camera