Skip to content

Commit 07b3946

Browse files
committed
keep the old name alive for old versions
1 parent 66e87da commit 07b3946

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

1.hello-world/1.minimum-code.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<meta name="description" content="Quickly read barcodes with Dynamsoft Barcode Reader from a live camera stream.">
8+
<meta name="keywords" content="camera based barcode reading">
9+
<title>Dynamsoft Barcode Reader Sample - Hello World (Decoding via Camera)</title>
10+
</head>
11+
12+
<body>
13+
Loading...
14+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
15+
<script>
16+
/** LICENSE ALERT - README
17+
* To use the library, you need to first specify a license key using the API "license" as shown below.
18+
*/
19+
20+
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
21+
22+
/**
23+
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
24+
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
25+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
26+
* LICENSE ALERT - THE END
27+
*/
28+
29+
window.onload = async function() {
30+
try {
31+
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
32+
/**
33+
* onFrameRead is triggered after the library finishes reading a frame image.
34+
* There can be multiple barcodes on one image.
35+
*/
36+
scanner.onFrameRead = results => {
37+
console.log("Barcodes on one frame:");
38+
for (let result of results) {
39+
console.log(result.barcodeFormatString + ": " + result.barcodeText);
40+
}
41+
};
42+
/**
43+
* onUniqueRead is triggered only when a 'new' barcode is found.
44+
* The amount of time that the library 'remembers' a barcode is defined by
45+
* "duplicateForgetTime" in "ScanSettings". By default it is set to 3000 ms.
46+
*/
47+
scanner.onUniqueRead = (txt, result) => {
48+
alert(txt);
49+
console.log("Unique Code Found: ", result);
50+
}
51+
/**
52+
* show() opens the camera and shows the video stream on the page.
53+
* After that, the library starts to scan the frame images continuously.
54+
*/
55+
await scanner.show();
56+
} catch (ex) {
57+
throw ex;
58+
}
59+
};
60+
</script>
61+
</body>
62+
63+
</html>

0 commit comments

Comments
 (0)