capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 167 forks source link

Error on stopScan when startScan didn't fully loaded yet #296

Open SeddikKadi opened 11 months ago

SeddikKadi commented 11 months ago

Describe the bug on web platform, when i start the scan and call stopScan before the camera fully loaded i get the following error: Uncaught (in promise) TypeError: st is null on st.getTracks() in the following function:


        var _a;
        if (this._video) {
            this._video.pause();
            const st = this._video.srcObject;
            const tracks = st.getTracks();
            for (var i = 0; i < tracks.length; i++) {
                var track = tracks[i];
                track.stop();
            }
            (_a = this._video.parentElement) === null || _a === void 0 ? void 0 : _a.remove();
            this._video = null;
        }
    }```