mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-01-31 00:45:24 +01:00
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:
committed by
GitHub
parent
a97033bcd9
commit
b60dd88702
6
.changes/barcode-scanner-ios-thread.md
Normal file
6
.changes/barcode-scanner-ios-thread.md
Normal 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.
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user