-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
53 lines (45 loc) · 1.07 KB
/
index.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
47
48
49
50
51
52
53
<html>
<head>
<title>QRCode.js</title>
<script type="text/javascript" src="dist/qrcode.js"></script>
</head>
<body>
<video width="320px" height="240px" id="video" autoplay></video>
<pre>
function onSuccess(data) {
document.getElementById('video').setAttribute("style", "border: 3px solid #52e250");
console.log('Sucess:', data);
}
function onError(err) {
console.error(err);
}
QrReader.getBackCamera().then(function(device) {
new QrReader({
sucessCallback: onSuccess,
errorCallback: onError,
videoSelector: '#video',
stopOnRead: true,
deviceId: device.deviceId,
});
});
</pre>
</body>
<script>
function onSuccess(data) {
document.getElementById('video').setAttribute("style", "border: 3px solid #52e250");
console.log('Sucess:', data);
}
function onError(err) {
console.error(err);
}
QrReader.getBackCamera().then(function(device) {
new QrReader({
sucessCallback: onSuccess,
errorCallback: onError,
videoSelector: '#video',
stopOnRead: true,
deviceId: device.deviceId,
});
});
</script>
</html>