Open rpaugh opened 1 year ago
Same thing happens on Android and Windows. Any luck with this issue?
Seems like this could help:
const mediaStream = videoElement.srcObject;
if (mediaStream instanceof MediaStream) {
const tracks = mediaStream.getTracks();
tracks.forEach(track => {
track.stop();
});
videoElement.srcObject = null;
}
By "videoElement" are you referring to the video html tag?
Yes, the one you are passing as parameter to QrScanner constructor.
After launching the camera on iOS, the barcode is correctly scanned and processed in the background, the camera pauses letting you know this action took place, but the camera never closes. I have to manually close out of the camera to get back to my app that launched it. I am calling scanner.stop() during the setResult call:
` const scanner = new QrScanner(video, result => setResult(fileQrResult, result), { onDecodeError: error => { fileQrResult.textContent = error; fileQrResult.style.color = 'inherit'; }, highlightScanRegion: true, highlightCodeOutline: true }); scanner.setCamera('user');
... }`
Is there something else I need to do for the scanner to force close the camera after the scan?