From c7d9c662ab58b10ec8d91ef6e8665b5f1b5285db Mon Sep 17 00:00:00 2001 From: Raja Baz Date: Fri, 14 Oct 2016 23:29:39 +0300 Subject: [PATCH] Fix auto exposure and autofocus not working properly. Issue 341 --- Library/Sources/SCRecorder.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Library/Sources/SCRecorder.m b/Library/Sources/SCRecorder.m index 97183d0d..97a94c6a 100644 --- a/Library/Sources/SCRecorder.m +++ b/Library/Sources/SCRecorder.m @@ -971,7 +971,17 @@ - (void)configureDevice:(AVCaptureDevice*)newDevice mediaType:(NSString*)mediaTy if (newDevice.isSmoothAutoFocusSupported) { newDevice.smoothAutoFocusEnabled = YES; } - newDevice.subjectAreaChangeMonitoringEnabled = true; + + if ([newDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus]) { + newDevice.subjectAreaChangeMonitoringEnabled = true; + } else { + if ([newDevice isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) { + newDevice.exposureMode = AVCaptureExposureModeContinuousAutoExposure; + } + if ([newDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) { + newDevice.exposureMode = AVCaptureFocusModeContinuousAutoFocus; + } + } if (newDevice.isLowLightBoostSupported) { newDevice.automaticallyEnablesLowLightBoostWhenAvailable = YES;