Skip to content

Commit

Permalink
Fix broken iOS 14 AV apple api (#293)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik <erik@bitfactory.io>
  • Loading branch information
ErikGro and Erik authored Jan 27, 2021
1 parent 39556c5 commit 9787c79
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions WeScan/Scan/CaptureSessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ final class CaptureSessionManager: NSObject, AVCaptureVideoDataOutputSampleBuffe

captureSession.beginConfiguration()

let photoPreset = AVCaptureSession.Preset.photo

if captureSession.canSetSessionPreset(photoPreset) {
captureSession.sessionPreset = photoPreset
}

photoOutput.isHighResolutionCaptureEnabled = true

let videoOutput = AVCaptureVideoDataOutput()
Expand Down Expand Up @@ -119,6 +113,13 @@ final class CaptureSessionManager: NSObject, AVCaptureVideoDataOutputSampleBuffe
captureSession.addOutput(photoOutput)
captureSession.addOutput(videoOutput)

let photoPreset = AVCaptureSession.Preset.photo

if captureSession.canSetSessionPreset(photoPreset) {
captureSession.sessionPreset = photoPreset
photoOutput.isLivePhotoCaptureEnabled = true
}

videoPreviewLayer.session = captureSession
videoPreviewLayer.videoGravity = .resizeAspectFill

Expand Down

0 comments on commit 9787c79

Please sign in to comment.