-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQR.html
More file actions
152 lines (105 loc) · 4.64 KB
/
QR.html
File metadata and controls
152 lines (105 loc) · 4.64 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="QR.css">
<title>Book Management</title>
<script src="libraryManagement.js"></script>
<script src="QR.js"></script>
</head>
<body>
<div class="row">
<div class="col1">
<div style="width:500px;" id="reader"></div>
</div>
<div class="col">
<h4>SCAN RESULT</h4>
<div id="result">Result Here</div>
<a href="book.html" class="link">Book</a>
</div>
</div>
<script type="text/javascript">
function onScanSuccess(qrCodeMessage) {
document.getElementById('result').innerHTML = '<span class="result">'+qrCodeMessage+'</span>';
console.log(qrCodeMessage);
//let myarray=qrCodeMessage.spilt(",");
//console.log(qrCodeMessage[0]);
find(qrCodeMessage);
}
function onScanError(errorMessage) {
//handle scan error
}
var html5QrcodeScanner = new Html5QrcodeScanner(
"reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess, onScanError);
</script>
</body>
</html>
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="description" content="Quickly read barcodes with Dynamsoft Barcode Reader from a live camera stream.">
<meta name="keywords" content="camera based barcode reading">
<link rel="canonical" href="https://demo.dynamsoft.com/Samples/DBR/JS/1.hello-world/1.hello-world.html">
<title>Dynamsoft Barcode Reader Sample - Hello World (Decoding via Camera)</title>
</head>
<body>
Loading...
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.3.1/dist/dbr.js"></script>
<script>
/** LICENSE ALERT - README
* To use the library, you need to first specify a license key using the API "license" as shown below.
*/
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
/**
* 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.
* 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.
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.3.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
* LICENSE ALERT - THE END
*/
(async function() {
try {
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
/**
* 'onFrameRead' is triggered after the library finishes reading a frame image.
* There can be multiple barcodes on one image.
*/
scanner.onFrameRead = results => {
console.log("Barcodes on one frame:");
for (let result of results) {
const format = result.barcodeFormat ? result.barcodeFormatString : result.barcodeFormatString_2;
console.log(format + ": " + result.barcodeText);
}
};
/**
* 'onUniqueRead' is triggered only when a 'new' barcode is found.
* The amount of time that the library 'remembers' a barcode is defined by
* "duplicateForgetTime" in "ScanSettings". By default it is set to 3000 ms.
*/
scanner.onUniqueRead = (txt, result) => {
alert(txt);
console.log("Unique Code Found: ", result);
}
/**
* 'show()' opens the camera and shows the video stream on the page.
* After that, the library starts to scan the frame images continuously.
*/
await scanner.show();
} catch (ex) {
let errMsg;
if (ex.message.includes("network connection error")) {
errMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
} else {
errMsg = ex.message||ex;
}
console.error(errMsg);
alert(errMsg);
}
})();
</script>
</body>
</html> -->