I have successfully turned on the setSubjectAreaChangeMonitoringEnabled:
self.videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[self.videoDevice lockForConfiguration:nil]; //you must lock before setting torch mode
[self.videoDevice setSubjectAreaChangeMonitoringEnabled:YES];
[self.videoDevice unlockForConfiguration];
in start method I have included the following notification:
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(areWeFocused:)
name: AVCaptureDeviceSubjectAreaDidChangeNotification
object: nil];
Then I have the areWeFocused method (which I know is wrong but I need help with it):
- (void)areWeFocused:(NSNotification *) notification {
BOOL adjusting = [self.videoDevice isAdjustingFocus];
if (!adjusting) {
//NSLog(@"I have focus");
} else {
NSLog(@"NOT");
}
}
If uncommented my NSLog always prints I have focus, but commenting that line I never get NOT. How can I detect if we are in focus? BTW: Focus mode is AutoFocus and ContinuousAutoFocus
Thank you for your help.