Is it possible to dim the light of iPhone's camera flash light programmatically?
Please let me know.
从iOS 6.0开始,有一个新的调用setTorchModeOnWithLevel
,它允许您设置火炬级别。
- (BOOL)setTorchModeOnWithLevel:(float)torchLevel error:(NSError **)outError
iOS5 will help you with this. It is still under NDA. I suggest you look in the beta documentation for AVCaptureDevice or ask on the Apple developer forum.
It is not possible in iOS4.3.
When the NDA is lifted I will edit this response to give the documentation link.
EDIT
Sorry, it looks like Apple removed the ability to change the torch level in the public release of iOS5. The torchLevel
property of AVCaptureDevice
is now read-only.
Something like this should work i think:
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOff];
[device unlockForConfiguration];
}
I don't think that still they have these controls in Public APIs for the developers to change it.
I think we can turn it on or off as it is many torch applications but I don't think we can decrease the intensity(ie dim the flash light) .
There are signs that this may get into public API onc iOS5 is launched but for now, it is not possible.
Also using iOS5 beta for development would not help as some of the features in iOS5 are still errorneous and are yet to be solved.
Hopefully it will get resolved in the final release.
Hope this helps you. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.