turn on flash

Anyone know the command or api to turn on and off the flash on an iPhone? I can't find it anywhere with Google.

Answered by LCS in 238264022

I don't mean turning it on for an extended period of time. I mean to turn it on and off briefly for a fragment of time.

Accepted Answer

I actually had found that solution. I suspected that there is a simpler way. But that will do. Thanks. If anyone knows of a more direct way I would be interested in learning it.

Please note the definitions. An iPhone has a flash and a torch. The flash fires when a photo is taken. The torch can be switched on independently of taking a photo (e.g. for a video recording). The torch can be switched on/off with a maximum frequency of 120 Hz as far as I know.
If you want full-intensity flash: set the flash mode to auto or on and take a photo. Other than that, you can switch on/off the torch light either by setting the torch mode to on or by setting it on with a certain intensity level (see link below). Be aware that you need a running capture session to get full intensity for the torch (which is still less intense than the flash).

https://developer.apple.com/documentation/avfoundation/avcapturedevice/flashmode

https://developer.apple.com/documentation/avfoundation/avcapturedevice/1624609-settorchmodeon
turn on flash
 
 
Q