Is there a way to turn off the LED light on the iPhone 4?

Is there a way or property that allows you to set the brightness of the LED indicator on the iPhone 4?

+4
source share
3 answers

There is a brightness method available for iOS 6 and later.

[AVCaptureDevice setTorchModeOnWithLevel:1.0 error:&error]; 

"Level" is a float from 0 to ~ 1, AVCaptureMaxAvailableTorchLevel . The oscillation of this parameter will allow us to change the brightness.

+5
source

The intensity of the LED light never changes when using the camera as a flash, regardless of the ambient lighting conditions, so I assume that the hardware only supports a fixed on / off switch for light with constant brightness.

If there is a way to change the brightness, at the moment it does not open through the public API.

0
source

In principle, the brightness can be varied using the PWM method (pulse width modulation): for example, for 50% brightness, turn on the LED for a certain period of time, then turn it off for the same period of time, and so on and so forth. If you perform fast enough, no flicker will be visible, and the brightness will be 50%.

Unfortunately, I have not yet found a way to switch the iPhone LED at a high enough frequency. Switching AVCaptureTorchModeOn / AVCaptureTorchModeOff doesn't look fast enough - or maybe the main thread (which I tried on) has too low priority on iOS.

Edit: iOS 6 now has an API for setting the level of the torch .

0
source

Source: https://habr.com/ru/post/1314392/


All Articles