Multiple Scanners Demo
This page renders two scanners under separate BarcodeScannerProvider instances. Use it to verify that scanner A and scanner B do not overwrite or clean up each other's stream, torch state, errors or detected values.
Manual test checklist
- Allow camera permission and compare the two stream IDs.
- Scan a code in front of each active camera and confirm that results remain in the correct card.
- Pause or unmount scanner A and confirm that scanner B remains unchanged.
- Change the format or torch state in one card and inspect the other card's diagnostics.
- Reset one Provider scope and confirm that only that card returns to fresh state.
- If the second camera fails to open, confirm that its error stays inside that card while the first scanner continues working.
Opening two streams from one physical camera is device- and browser-dependent. A second-stream failure is not by itself a Provider isolation failure.
Each card owns a separate BarcodeScannerProvider. Some browsers or devices cannot open the same physical camera twice; an error in only one card still demonstrates that the scopes are isolated.
Scanner A
Resetting this scope unmounts its Provider and creates a fresh store. The other scanner must remain unchanged.
Instance diagnostics
- Provider scope
scanner-a- Stream ID
none- Video track
- none
- Track state
none- Scanner state
- waiting for camera
- Torch supported
- no
- Torch requested
- off
Latest detected values
No barcode detected in this scope.
Scanner B
Resetting this scope unmounts its Provider and creates a fresh store. The other scanner must remain unchanged.
Instance diagnostics
- Provider scope
scanner-b- Stream ID
none- Video track
- none
- Track state
none- Scanner state
- waiting for camera
- Torch supported
- no
- Torch requested
- off
Latest detected values
No barcode detected in this scope.