Hey @simonmitchell. We are currently dealing with the same issue. did you receive any feedback from Apple yet? I can't seem to open the link to your radar, but I'm not sure if I just don't have access to it.
I have written the following code to gather some data on this issue.
It simply flashes the torch at 10 Hz and measures the current time before every torchMode change and usleep call. You can also see that it generates a list of "ideal" timings, which assumes that the torchMode changes are instant and the usleep calls are perfectly accurate. This is obviously not possible, but allows us to calculate the deviation between our hypothetical ideal scenario and the real world.
let device = AVCaptureDevice.default(for: .video)!
try device.lockForConfiguration()
var measurements: [CFTimeInterval] = []
let repeats = 300
let durationMs = 50
let durationUs = UInt32(durationMs * 1000)
var ideal: [CFTimeInterval] = []
for _ in 0..<repeats {
ideal.append(0.0)
ideal.append(CFTimeInterval(durationMs))
ideal.append(0.0)
ideal.append(CFTimeInterval(durationMs))
}
for i in 0..<repeats {
measurements.append(CACurrentMediaTime())
device.torchMode = .on
measurements.append(CACurrentMediaTime())
usleep(durationUs)
measurements.append(CACurrentMediaTime())
device.torchMode = .off
measurements.append(CACurrentMediaTime())
usleep(durationUs)
}
measurements.append(CACurrentMediaTime())
device.unlockForConfiguration()
var diffs: [CFTimeInterval] = []
for (i, timestamp) in measurements[1...].enumerated() {
let previous = measurements[i]
diffs.append((timestamp - previous) * 1000 - ideal[i])
}
let str = diffs.map({ String($0) }).joined(separator: "\n")
print(str)
I ran this demo in a dark room on an iPhone 15 Pro Max and iPhone 13 Mini.
The measured results can be seen in the graph below.
The marked area in red roughly shows the time that the room lights were turned on.
You can clearly see that after turning the ambient light on the iPhone 15 Pro Max regularly takes up to almost 500ms to update the torchMode. The iPhone 13 Mini experiences no such problems. Even after the light is turned off again the iPhone 15 Pro Max continues to miss the desired timings.
I took a video of the demo that you can see here: https://drive.google.com/file/d/1CBWEBWPvq_QF_TLud1-8m1G5guFn_0Qq/view - I sadly cannot make this a proper link, because the Forum seems to block the domain. Uploading the video file itself is also not possible. Here's a screenshot of the setup for good measure:
I was able to reliably and consistently reproduce this issue on an iPhone 15 Pro and iPhone 15 Pro Max. I couldn't get my hands on any iPhone 16 myself yet, but after asking friends to take a slow motion video of a generic strobe app in a bright room it looks like they are not affected.