-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path4k-speed.html
46 lines (45 loc) · 1.65 KB
/
4k-speed.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<style>
html,body{width:100%;height:100%;display:flex;margin:0;padding:0;}
</style>
</head>
<body>
<div id="ui" style="width:60vw;height:100%;box-sizing:border-box;"></div>
<textarea id="result" style="width:40vw;height:100%;box-sizing:border-box;"></textarea>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
<script>
// initializes and uses the library
(async () => {
let scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
scanner.onFrameRead = results => {
if (results.length > 0) console.log(results);
};
scanner.onUniqueRead = (txt, result) => {
console.log(txt);
document.getElementById('result').value += txt+'\n';
};
await scanner.updateRuntimeSettings("speed");
let rtSettings = await scanner.getRuntimeSettings();
rtSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED;
await scanner.updateRuntimeSettings(rtSettings);
await scanner.updateVideoSettings({
video: {
width: {
ideal: 3840
},
height: {
ideal: 2160
},
facingMode: {
ideal: 'environment'
}
}
});
document.getElementById('ui').appendChild(await scanner.getUIElement());
await scanner.open();
})();
</script>
</body>
</html>