I work with Swift 3 and I use camera AVFoundation
Who know is there any way to know capacity of light?
I know that one of the approach is use ambient light sensor, but it is don't encourage and eventually apps doesn't allows in market
I found question very close to that I need
detecting if iPhone is in a dark room
And that guy explains that I can use ImageIO framework, read the metadata that's coming in with each frame of the video feed
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL, sampleBuffer, kCMAttachmentMode_ShouldPropagate);
NSDictionary *metadata = [[NSMutableDictionary alloc] initWithDictionary:(__bridge NSDictionary*)metadataDict];
CFRelease(metadataDict);
NSDictionary *exifMetadata = [[metadata objectForKey:(NSString *)kCGImagePropertyExifDictionary] mutableCopy];
float brightnessValue = [[exifMetadata objectForKey:(NSString *)kCGImagePropertyExifBrightnessValue] floatValue];
}
But I am a rookie in iOS and don't know how to convert this code in Swift
Thanks in advance!