From c3bd44362a78c3b5f1afec0ccf6ddf5a2973bdcb Mon Sep 17 00:00:00 2001 From: Symon Rottem Date: Tue, 16 Aug 2016 14:46:00 +0200 Subject: [PATCH] html5_qrcode_stop did not reliably cancel ongoing calls to the scan function. --- src/html5-qrcode.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/html5-qrcode.js b/src/html5-qrcode.js index 3650eff..801c7f4 100644 --- a/src/html5-qrcode.js +++ b/src/html5-qrcode.js @@ -32,11 +32,6 @@ } catch (e) { qrcodeError(e, localMediaStream); } - - $.data(currentElem[0], "timeout", setTimeout(scan, 500)); - - } else { - $.data(currentElem[0], "timeout", setTimeout(scan, 500)); } };//end snapshot function @@ -49,7 +44,7 @@ $.data(currentElem[0], "stream", stream); video.play(); - $.data(currentElem[0], "timeout", setTimeout(scan, 1000)); + $.data(currentElem[0], "timeout", setInterval(scan, 500)); }; // Call the getUserMedia method with our callback functions @@ -74,7 +69,7 @@ videoTrack.stop(); }); - clearTimeout($(this).data('timeout')); + clearInterval($(this).data('timeout')); }); } });