Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update AVCaptureSession.Preset resolution, enable ultrawide camera #236

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/barcode-scanning/ios/Plugin/BarcodeScannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,25 @@ public protocol BarcodeScannerViewDelegate {

let captureSession = AVCaptureSession()
captureSession.beginConfiguration()
captureSession.sessionPreset = AVCaptureSession.Preset.hd1280x720
captureSession.sessionPreset = AVCaptureSession.Preset.hd1920x1080
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this as this is a breaking change. Instead, you can create a separate PR to fix a bug. It should already be possible to set this setting via the resolution property. However, this does not seem to be the case at the moment.


// Prepare capture session and preview layer
// It executes tasks one at a time in the order they are added (FIFO), ensuring that no other
// tasks on the same queue can run simultaneously or out of order with respect to the synchronous
// block
captureSessionQueue.sync {
do {
let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: AVMediaType.video, position: settings.lensFacing)
let captureDevice: AVCaptureDevice? = {
if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: settings.lensFacing) {
return device
} else if let device = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: settings.lensFacing) {
return device
} else {
let device = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: settings.lensFacing)
return device
}
}()

guard let captureDevice = captureDevice else {
throw RuntimeError(implementation.plugin.errorNoCaptureDeviceAvailable)
}
Expand Down