Ian
Ian

Reputation: 1467

Enable True Tone torch in video mode for AVCaptureDevice

When using the iPhone camera app for the rear facing camera, the video mode torch option enables the True Tone LED, switching on all 4 LEDs (2 "white", 2 warmer).

However when accessing the camera in video mode through AVCaptureDevice, the torchMode options are only "on | off | auto" and neither enables the additional 2 warmer LEDs.

Is there a hidden function that enables this?

Generally, how are features like this usually enabled for the stock apps, and not for others? Is it a case of hidden functions in the api, that are possible to find? or something more low-level?

Upvotes: 1

Views: 462

Answers (1)

dauhen
dauhen

Reputation: 23

In addition to the torchMode on/off there is also setTorchLevel with a value from 0 to 1.0. I have tested this on several models of the iPhone. To do this I have created a simple app to play with the TorchLevel value. Here are the results.

Using the built in iPhone flashlight

iPhone 6s       white LED only (one LED)
iPhone 8        white LEDs only (two LEDs)
iPhone 10S      white LEDs only (two LEDs)
iPhone SE2      white LEDs only (two LEDs)

All phones use only white LEDs through four levels of brightness in the built in flashlight app.

Using the built in Camera App

iPhone 6s - iOS 13.7
  • white and yellow LEDs when flash turned from OFF to ON in video mode
  • white and yellow LEDs when flash is turned from AUTO to ON in video mode
  • white LED only when flash is left ON in video mode but you switch to photo mode and back to video mode
iPhone 8 - iOS 13.7
  • white and yellow LEDs on when flash turned on (AUTO) in video mode in a dark environment
iPhone SE - iOS 13.7 and iPhone 10S - iOS 14.0
  • white and yellow LEDs on when flash is turned on (AUTO) AND recording in a dark environment

All phones tend to use both the white and yellow LEDs while recording video except the iPhone 6s can be “tricked” into using just the white LED.

Using setTorchLevel = 0.0 through 1.0

iPhone 6s - iOS 13.7
Brightness transition levels with White LED only - yellow LED off:
    0.0     OFF
    0.005   1 
    0.5     2 
    0.835   3 
    0.995   4
    1.000   5 - Full Brightness

The iPhone 6s only lights up the White LED when using setTorchLevel to adjust the camera LED brightness.

iPhone 8 - iOS 13.7, iPhone SE - iOS 13.7, iPhone 10S - iOS 14.0

On the newer phones normally both the White and Yellow LEDs are active when setting the TorchLevel but you can "trick" the phones to get mainly the White LEDs active.

Brightness transition levels when White and Yellow LEDs are active:
    0.0     OFF
    0.005   1
    0.125   2
    0.165   3
    0.245   4
    0.285   5
    0.325   6
    0.405   7
    0.445   8
    0.525   9
    0.565   10
    0.605   11
    0.685   12
    0.725   13
    0.805   14
    0.845   15
    0.885   16
    0.965   17
    1.000   18 - Full Brightness

To turn off the yellow LEDs, use the photo app to take a flash picture in a dark environment. After that, setting torchLevel = 1.00 turns on White LEDs full power and yellow LEDs at < 1/2 power.

Reducing TorchLevel slowly from this point drops White LED brightness as in the above table and slowly extinguishes the Yellow LEDs

By 1/2 Power the Yellow LEDs are nearly out. Switching back to Full power yields White LEDs on full and yellow LEDs barely on.

As torch level is reduced the yellow LEDs remain at very low power and are fully extinguished at some levels (0.660, 0.330, 0.180, 0.100 and others).

Once the torch level is reduced to 0.090 the yellow LEDs “come alive” and their brightness tracks the White LED brightness over the full range of torch level until you take another flash picture with the camera app.

Upvotes: 2

Related Questions