Read Screen Brightness in Background

Hi


I have written an app with an audioEngine loop:


...//other code


input.installTap(onBus: 0, bufferSize:AVAudioFrameCount(bufferSize), format:format, block: { [weak self] buffer, when in

if (buffer.floatChannelData?[0]) != nil {


let audioData = Array(UnsafeBufferPointer(start: buffer.floatChannelData?[0], count:Int(buffer.frameLength)))

print("appending...")

print(UIScreen.main.brightness)


......// more code

It all works ffine. But when I print the UIScreen.main.brightness and the phone is locked (screen is off). it still reads 1.0, should it not read 0?

Best,

Feras A.