Open lucakermas opened 4 years ago
Was this error corrected?
I'm seeing this also with iOS 13
https://github.com/cozmo/jsQR/blob/master/src/locator/index.ts#L451
as this seems to be a regression in Safari with iOS 13, I have filed a bug https://bugs.webkit.org/show_bug.cgi?id=211619
I have iOS 13.4.1 and it seems to work fine, excepting when phone tries to save battery and start screen saving mode.
El vie., 8 may. 2020 12:06, Zac Spitzer notifications@github.com escribió:
as this seems to be a regression in Safari with iOS 13, I have filed a bug https://bugs.webkit.org/show_bug.cgi?id=211619
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cozmo/jsQR/issues/157#issuecomment-625742837, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBJTGFQM3LEMFQOBNHGW4LRQPKTRANCNFSM4LG5SNVA .
I correct. On iPhone jsqr stops reading codes if none is found past the 1 minute mark.
I am having the same issue. Has anyone else found a workaround?
I am having the same issue on Mac OS X 10.15.4 and Safari 13.1.
I solved this issue by putting a try-catch around the jsQr()
call. However there must be some other way to check if the data can be used by jsQr.
But what would the solution be. that jsQr should just do nothing instead of throwing the error?
I do the same and works
onError = e => {
const errorMessage = !e ? 'Unknown Error' : e.message || e;
if (errorMessage === 'RangeError: Array size is not a small enough positive integer.') {
return;
}
worker.removeEventListener('message', onMessage);
worker.removeEventListener('error', onError);
clearTimeout(timeout);
reject('Scanner error: ' + errorMessage);
};
We had two issues going on simultaneously on iOS 13, one that caused the camera stream to freeze and one that caused this RangeError
.
1) The first one was due to us having our html video element the camera stream hooked up set to hidden
like this:
<video ref={ourRef} hidden/>
We think because the video was not visible to the user, safari decided to cut the video stream from the camera, hence freezing the stream. Having the video element visible on screen fixed this.
2) After fixing the freeze issue, the RangeError
kept popping up every now and then, but never caused a freeze. We easily circumvented it with a try-catch for now. Just skipping over any frames that resulted in the error.
Hope this can be of help to some of you!
I've been trying to work round this issue but no luck so far. (Unfortunately I don't have a device to test it on, and I have no clue what I'm doing!) I've tried @basz's suggestion but that doesn't seem to have worked https://github.com/jt-nti/qr-scanner/blob/71-webkit-bug/src/qr-scanner.js#L220 Any other tips/ideas would be much appreciated, thanks.
I also ran into this problem recently here is what I've found so far:
I hope this helps someone more familiar with the code of this library to get to the bottom of this since I don't have the resources to dig into it right now.
If you just want to prevent it from freezing, you can modify it as follows. (It is not a fundamental solution.) https://github.com/cozmo/jsQR/blob/master/src/index.ts#L26
function scan(matrix: BitMatrix): QRCode | null {
try { // add
const locations = locate(matrix);
if (!locations) {
return null;
}
for (const location of locations) {
.........................................
}
return null;
} catch(e) { // add
if (e instanceof RangeError) return null; // add
throw e; // add
} // add
}
After some seconds jsQR keeps on getting the following error: array size is not a small enough positive integer
This is only happening on my iPhone with Safari. It does this on the demo, too.