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
Branches
No related tags found
No related merge requests found
...@@ -86,7 +86,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -86,7 +86,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
this.clipMask = false; this.clipMask = false;
this._devices = new Map(); this._devices = new Map();
this._frameRequestID = null;
} }
static get scopedElements() { static get scopedElements() {
...@@ -193,15 +192,13 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -193,15 +192,13 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
video.play(); video.play();
that.videoRunning = true; that.videoRunning = true;
qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' }); qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
that._frameRequestID = requestAnimationFrame(tick); requestAnimationFrame(tick);
}).catch((e) => { console.log(e); that.askPermission = true;}); }).catch((e) => { console.log(e); that.askPermission = true;});
let lastVideoTime = -1; let lastVideoTime = -1;
let lastCode = null; let lastCode = null;
function tick() { function tick() {
that._frameRequestID = null;
if (that.sourceChanged) { if (that.sourceChanged) {
video.srcObject.getTracks().forEach(function(track) { video.srcObject.getTracks().forEach(function(track) {
track.stop(); track.stop();
...@@ -343,7 +340,7 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -343,7 +340,7 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' }); qrContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
scroll = true; scroll = true;
} }
that._frameRequestID = requestAnimationFrame(tick); requestAnimationFrame(tick);
} }
} }
...@@ -362,11 +359,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -362,11 +359,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
* *
*/ */
stopScanning() { stopScanning() {
if (this._frameRequestID !== null) {
cancelAnimationFrame(this._frameRequestID);
this._frameRequestID = null;
}
this.askPermission = false; this.askPermission = false;
this.videoRunning = 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