diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 99f5ebe..ea80551 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -41,8 +41,6 @@ export class AppComponent implements OnInit {
case 'VERSION_DETECTED':
console.log(`Downloading new app version: ${evt.version.hash}`);
this.presentUpdateAlert();
- // if (confirm('A new version is available. Load it?'))
- // window.location.reload();
break;
case 'VERSION_READY':
console.log(`Current app version: ${evt.currentVersion.hash}`);
diff --git a/src/app/components/application-header/application-header.component.html b/src/app/components/application-header/application-header.component.html
index f241b5a..7aaa1ef 100644
--- a/src/app/components/application-header/application-header.component.html
+++ b/src/app/components/application-header/application-header.component.html
@@ -17,9 +17,9 @@
-
+
diff --git a/src/app/components/qrcode-popup/qrcode-popup.component.ts b/src/app/components/qrcode-popup/qrcode-popup.component.ts
index e6b8200..dafd7ec 100644
--- a/src/app/components/qrcode-popup/qrcode-popup.component.ts
+++ b/src/app/components/qrcode-popup/qrcode-popup.component.ts
@@ -89,10 +89,6 @@ export class QrcodePopupComponent implements OnInit {
this.scanResult = null;
}
- stopScan() {
- this.scanActive = false;
- }
-
async startScan() {
// Not working on iOS standalone mode!
const stream = await navigator.mediaDevices.getUserMedia({
@@ -109,6 +105,21 @@ export class QrcodePopupComponent implements OnInit {
this.videoElement.play();
requestAnimationFrame(this.scan.bind(this));
}
+
+ stopScan() {
+ this.scanActive = false;
+
+ const stream = this.videoElement.srcObject;
+ if (stream) {
+ const tracks = stream.getTracks();
+ tracks.forEach(function(track: MediaStreamTrack) {
+ track.stop();
+ console.log('Track stopped:', track.readyState);
+
+ });
+ this.videoElement.srcObject = null;
+ }
+ }
async scan() {
try {
@@ -140,9 +151,10 @@ export class QrcodePopupComponent implements OnInit {
inversionAttempts: 'dontInvert'
});
- if (code) {
+ if (code?.data) {
this.scanActive = false;
this.scanResult = code.data;
+ this.stopScan();
this.showQrToast();
} else {
if (this.scanActive) {
diff --git a/www/index.html b/www/index.html
index 57153fc..18c763c 100644
--- a/www/index.html
+++ b/www/index.html
@@ -25,6 +25,6 @@
-
+