Closed A-Fairooz closed 8 months ago
I ran into the issue where my camera wouldn't refocus, I narrowed down the cause to the initialization of the CodeScannerView
public init( codeTypes: [AVMetadataObject.ObjectType], scanMode: ScanMode = .once, manualSelect: Bool = false, scanInterval: Double = 2.0, showViewfinder: Bool = false, simulatedData: String = "", shouldVibrateOnSuccess: Bool = true, isTorchOn: Bool = false, isGalleryPresented: Binding<Bool> = .constant(false), videoCaptureDevice: AVCaptureDevice? = AVCaptureDevice.bestForVideo, // <---- THIS completion: @escaping (Result<ScanResult, ScanError>) -> Void )
When setting the videoCaptureDevice, having it set to bestForVideo on later iPhones sets it to the wide-angle lens and stops you from manually being able to focus, my current fix was replacing it with this:
videoCaptureDevice: AVCaptureDevice? = AVCaptureDevice.default(for: .video)
I ran into the issue where my camera wouldn't refocus, I narrowed down the cause to the initialization of the CodeScannerView
When setting the videoCaptureDevice, having it set to bestForVideo on later iPhones sets it to the wide-angle lens and stops you from manually being able to focus, my current fix was replacing it with this: