Skip to content
Snippets Groups Projects
Commit 06653184 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Revert "Properly cancel all queued callbacks when stopping"

This reverts commit 3c5c82f9.
parent 3c5c82f9
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
this.clipMask = false;
this._devices = new Map();
this._frameRequestID = null;
}
static get scopedElements() {
......@@ -193,15 +192,13 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
video.play();
that.videoRunning = true;
qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
that._frameRequestID = requestAnimationFrame(tick);
requestAnimationFrame(tick);
}).catch((e) => { console.log(e); that.askPermission = true;});
let lastVideoTime = -1;
let lastCode = null;
function tick() {
that._frameRequestID = null;
if (that.sourceChanged) {
video.srcObject.getTracks().forEach(function(track) {
track.stop();
......@@ -343,7 +340,7 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
scroll = true;
}
that._frameRequestID = requestAnimationFrame(tick);
requestAnimationFrame(tick);
}
}
......@@ -362,11 +359,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
*
*/
stopScanning() {
if (this._frameRequestID !== null) {
cancelAnimationFrame(this._frameRequestID);
this._frameRequestID = null;
}
this.askPermission = false;
this.videoRunning = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment