Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Commit

Permalink
Use AVCaptureFocusModeContinuousAutoFocus for focus mode on init
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebuss committed Sep 17, 2016
1 parent e5ea600 commit e7a6f26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/ios/Scanners/MTBBarcodeScanner.m
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,16 @@ - (AVCaptureDevice *)newCaptureDeviceWithCamera:(MTBCamera)camera {
newCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
}

// Using AVCaptureFocusModeContinuousAutoFocus helps improve scan times
NSError *error = nil;
if ([newCaptureDevice lockForConfiguration:&error]) {
if (newCaptureDevice.isFocusPointOfInterestSupported &&
[newCaptureDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
newCaptureDevice.focusMode = AVCaptureFocusModeContinuousAutoFocus;
}
[newCaptureDevice unlockForConfiguration];
}

return newCaptureDevice;
}

Expand Down

0 comments on commit e7a6f26

Please sign in to comment.