fix(barcode-scanner): start capture session on a separate thread (#3223)

fixes the given warning:

Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness

which might cause a UI freeze
This commit is contained in:
Lucas Fernandes Nogueira
2026-01-19 13:16:16 -03:00
committed by GitHub
parent a97033bcd9
commit b60dd88702
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
barcode-scanner: patch
barcode-scanner-js: patch
---
On iOS, start the scanning session on a separate thread to fix performance issues.

View File

@@ -286,7 +286,9 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
}
self.metaOutput!.metadataObjectTypes = self.scanFormats
self.captureSession!.startRunning()
DispatchQueue.main.async {
self.captureSession!.startRunning()
}
self.isScanning = true
}