Is it possible to dim the light of iPhone's camera flash light programmatically?
Please let me know.
Is it possible to dim the light of iPhone's camera flash light programmatically?
Please let me know.
As of iOS 6.0, there is a new call, setTorchModeOnWithLevel
, which allows you to set the torch level.
- (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(i.e. 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. :)