-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(performances): improve scan performances
- Loading branch information
1 parent
ea5557b
commit 60a4b7c
Showing
5 changed files
with
134 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
## 2.2.1 | ||
|
||
- Improve scan performance (JS Library changed) | ||
- Improve scan performance | ||
|
||
## 2.2.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
function detectBarcode(dataUrl, callback) { | ||
const hints = new Map(); | ||
hints.set('TRY_HARDER', true); | ||
const codeReader = new ZXingBrowser.BrowserMultiFormatReader(hints); | ||
console.log('ZXing code reader initialized'); | ||
codeReader.decodeFromImageUrl(dataUrl).then((result) => { | ||
console.log(result); | ||
callback(result.text); | ||
}).catch((err) => { | ||
//console.error(err); | ||
}) | ||
console.log(`Started decode for image from ${dataUrl.src}`); | ||
Quagga.decodeSingle({ | ||
decoder: { | ||
readers: [ | ||
"code_128_reader", | ||
"ean_reader", | ||
"ean_8_reader", | ||
"code_39_reader", | ||
"code_39_vin_reader", | ||
"code_93_reader" | ||
] // List of active readers | ||
}, | ||
locate: true, // try to locate the barcode in the image | ||
src: dataUrl // or 'data:image/jpg;base64,' + data | ||
}, function (result) { | ||
if (result && result.codeResult) { | ||
console.log("result", result.codeResult.code); | ||
callback(result.codeResult.code); | ||
} else { | ||
console.log("not detected"); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters