From 0665318420a87e01e230be54b2e84eaeb9bd66d9 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 21 Oct 2020 12:09:46 +0200
Subject: [PATCH] Revert "Properly cancel all queued callbacks when stopping"

This reverts commit 3c5c82f9799503890cbe5b937c2a0eee21723acb.
---
 packages/qr-code-scanner/src/qr-code-scanner.js | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/packages/qr-code-scanner/src/qr-code-scanner.js b/packages/qr-code-scanner/src/qr-code-scanner.js
index e9d814f2..642fef71 100644
--- a/packages/qr-code-scanner/src/qr-code-scanner.js
+++ b/packages/qr-code-scanner/src/qr-code-scanner.js
@@ -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;
     }
-- 
GitLab