Skip to content

Commit

Permalink
fix: fix scanner crashing when camera not allowed by user. closes #309
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Feb 28, 2024
1 parent 09f1133 commit 7c8c086
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/BarcodeScanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export default {
// console.warn(`Code scan error = ${error}`)
},
close() {
this.scanner.stop()
// https://scanapp.org/html5-qrcode-docs/docs/apis/enums/Html5QrcodeScannerState
if (this.scanner.getState() > 1) {
this.scanner.stop()
}
this.$emit('close')
},
}
Expand Down

0 comments on commit 7c8c086

Please sign in to comment.