-
Notifications
You must be signed in to change notification settings - Fork 0
/
qrcode.html
37 lines (34 loc) · 888 Bytes
/
qrcode.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
<html>
<head>
<title>QRCode Reader</title>
<script type="text/javascript" src="{{
url_for('static', filename='instascan.min.js')}}"></script>
<style>
.text{
resize: none;
}
</style>
</head>
<body>
<video id="preview"></video>
<textarea disabled class="text" id='qr'>QRcode info</textarea>
<script>
let scanner = new Instascan.Scanner(
{
video: document.getElementById('preview')
}
);
Instascan.Camera.getCameras().then(cameras =>
{
if(cameras.length > 0){
scanner.start(cameras[0]);
} else {
console.error("No Camera Found");
}
});
scanner.addListener('scan', function(content) {
document.getElementById('qr').value = content;
});
</script>
</body>
</html>