Giter Club home page Giter Club logo

Comments (3)

adam1st avatar adam1st commented on June 12, 2024 2

I have fixed it, putting this here for others who have the same issue or hoping contributors could possibly add this as a function of the app to chose which lens to use.

  1. I downloaded a local copy of the git
  2. In Xcode I removed the dependency on the package from git (Click on the main blue project icon, package dependencies, WeScan, and clicked - )
  3. Added the package dependancy based on the local copy (so I could alter the files of the package) - XCode, File, Add Package Depdancy, click Add Local button, browse for the local copy and add
  4. The following 4 files were where I found the code is selecting AVCaptureDevice (in Scan and Session folders): CameraScannerViewController, CaptureSessionManager, ScannerViewController, CaptureSession
  5. Search for AVCaptureDevice and replace this: guard let device = AVCaptureDevice.default(for: AVMediaType.video) with the following to CameraScannerViewController and ScannerViewController:

let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualWideCamera, .builtInDualCamera, .builtInWideAngleCamera], mediaType: .video, position: .back)
let selectedDevice = discoverySession.devices.first guard let device = selectedDevice else { return }

  1. Add this to CaptureSession:
    let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualWideCamera, .builtInDualCamera, .builtInWideAngleCamera], mediaType: .video, position: .back)
    let selectedDevice = discoverySession.devices.first self.device = selectedDevice

  2. And add this to CaptureSessionManager:

let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualWideCamera, .builtInDualCamera, .builtInWideAngleCamera], mediaType: .video, position: .back)

let selectedDevice = discoverySession.devices.first guard let device = selectedDevice else { let error = ImageScannerControllerError.inputDevice delegate?.captureSessionManager(self, didFailWithError: error) return nil }

Some links I found helpful:

https://teng.pub/technical/2022/6/9/let-ios-decide-the-best-lens-to-use
https://developer.apple.com/documentation/avfoundation/capture_setup/choosing_a_capture_device

from wescan.

github-actions avatar github-actions commented on June 12, 2024

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

from wescan.

masimplo avatar masimplo commented on June 12, 2024

Is this fix going to be integrated to the codebase at some point? We are facing the same issue and would be nice to not have to fork the repo for this fix.

from wescan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.