MB-2873 fixed settings
This commit is contained in:
parent
fd53f6a215
commit
3bf635e857
|
|
@ -61,6 +61,8 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
|
|||
|
||||
super.init()
|
||||
|
||||
configureDefaultDevice()
|
||||
|
||||
sessionQueue.async {
|
||||
self.configureDefaultComponents()
|
||||
}
|
||||
|
|
@ -141,6 +143,9 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
|
|||
// MARK: - Private Methods
|
||||
|
||||
private func configureDefaultComponents() {
|
||||
if #available(iOS 9.0, *) {
|
||||
session.sessionPreset = .hd4K3840x2160
|
||||
}
|
||||
|
||||
for output in session.outputs {
|
||||
session.removeOutput(output)
|
||||
|
|
@ -160,6 +165,28 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
|
|||
|
||||
session.commitConfiguration()
|
||||
}
|
||||
|
||||
private func configureDefaultDevice() {
|
||||
guard let device = defaultDevice else { return }
|
||||
|
||||
do {
|
||||
try device.lockForConfiguration()
|
||||
|
||||
if device.isAutoFocusRangeRestrictionSupported {
|
||||
device.autoFocusRangeRestriction = .near
|
||||
}
|
||||
|
||||
if device.isFocusModeSupported(.continuousAutoFocus) {
|
||||
device.focusMode = .continuousAutoFocus
|
||||
}
|
||||
|
||||
if device.isLowLightBoostSupported {
|
||||
device.automaticallyEnablesLowLightBoostWhenAvailable = true
|
||||
}
|
||||
|
||||
device.unlockForConfiguration()
|
||||
} catch _ { }
|
||||
}
|
||||
|
||||
// MARK: - AVCaptureMetadataOutputObjectsDelegate
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue