mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Close webcam when leaving scanner page.
This commit is contained in:
parent
3dd0ef26b3
commit
c58b36e9c5
1 changed files with 9 additions and 1 deletions
|
@ -569,17 +569,25 @@ $(document).on("ajaxUI:reload", function() {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Reuse codereader between multiple requests
|
||||||
|
const codeReader = new ZXing.BrowserMultiFormatReader();
|
||||||
|
|
||||||
//Init barcode scanner
|
//Init barcode scanner
|
||||||
$(document).on("ajaxUI:start ajaxUI:reload", function() {
|
$(document).on("ajaxUI:start ajaxUI:reload", function() {
|
||||||
|
|
||||||
//Skip if we are not on scanner page...
|
//Skip if we are not on scanner page...
|
||||||
if (!document.getElementById('scan_dialog_form')) {
|
if (!document.getElementById('scan_dialog_form')) {
|
||||||
|
|
||||||
|
codeReader.reset();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let selectedDeviceId;
|
let selectedDeviceId;
|
||||||
const codeReader = new ZXing.BrowserMultiFormatReader();
|
|
||||||
|
|
||||||
|
//Save it for later, so we can reset it
|
||||||
console.log('ZXing code reader initialized');
|
console.log('ZXing code reader initialized');
|
||||||
codeReader.listVideoInputDevices()
|
codeReader.listVideoInputDevices()
|
||||||
.then((videoInputDevices) => {
|
.then((videoInputDevices) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue