Apple’s documentation for startRunning() has this important note:
The startRunning() method is a blocking call which can take some time, therefore start the session on a serial dispatch queue so that you don’t block the main queue (which keeps the UI responsive). See AVCam: Building a Camera App for an implementation example.
This is borne out in practice. On an iPhone 15, the app hangs for about 2 seconds, since BarcodeScanning.Native.Maui calls startRunning() and stopRunning() on the main thread. Sometimes this doesn’t feel too bad, but when navigating to a page that has the barcode scanner already enabled, it feels quite glitchy.
Apple’s documentation for startRunning() has this important note:
This is borne out in practice. On an iPhone 15, the app hangs for about 2 seconds, since BarcodeScanning.Native.Maui calls startRunning() and stopRunning() on the main thread. Sometimes this doesn’t feel too bad, but when navigating to a page that has the barcode scanner already enabled, it feels quite glitchy.