Update session params

This commit is contained in:
Vlad Suhomlinov 2021-04-24 14:32:16 +03:00
parent ba9d350119
commit 96da0eccc2
1 changed files with 9 additions and 1 deletions

View File

@ -63,12 +63,20 @@ open class CardReader: BaseReader<Card> {
session.addInput(defaultDeviceInput)
}
session.sessionPreset = .hd1920x1080
videoDataOutput.alwaysDiscardsLateVideoFrames = true
videoDataOutput.setSampleBufferDelegate(self, queue: scannerObjectsQueue)
videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA]
videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_420YpCbCr8BiPlanarFullRange]
session.addOutput(videoDataOutput)
if ((try? defaultDevice?.lockForConfiguration()) != nil) {
defaultDevice?.videoZoomFactor = 2
defaultDevice?.autoFocusRangeRestriction = .near
defaultDevice?.unlockForConfiguration()
}
previewLayer.videoGravity = .resizeAspectFill
session.commitConfiguration()