-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
100 lines (57 loc) · 1.78 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
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
<html>
<head>
<title>ScanQRCode</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
</head>
<body>
<video autoplay="true" playsinline controls="true" id="vidWebCan"></video>
<h2>Cameras</h2>
<p>..</p>
<button id="btnAtivarCameras">Ativar Cameras</button>
<input id="edtEscolhaPerfeitaDe" name="edtEscolhaPerfeitaDe" type="text" placeholder="Numero da Carteira" value="" />
<button id="btnCancelarCameras">Cancelar Cameras</button>
<script>
console.log(Date.now());
</script>
<script src="adapter.js"></script>
<script src="https://etherlite.io/qrcode/jquery-1.6.4.min.js"></script>
<script src="instascan.js"></script>
<!-- <script src="instascan.min.js"></script> -->
<!-- <script src="https://etherlite.io/qrcode/instascan.min.js"></script> -->
<script>
var self = this;
var objScanners = null;
var objCameras = [];
jQuery(function () {
$('#btnAtivarCameras').click(function () {
console.log('Clicou');
self.objScanners = new Instascan.Scanner(
{
video: document.getElementById('vidWebCan'), scanPeriod: 5
});
objScanners.addListener('scan', content => {
console.log(content)
alert(content);
$("#edtEscolhaPerfeitaDe").val(content);
});
Instascan.Camera.getCameras().then(function (objCameras) {
self.objCameras = objCameras;
if (objCameras.length > 0) {
objScanners.start(objCameras[1]);
}
else {
console.log('No cameras found.');
}
}).catch(function (e) {
console.log(e);
});
});
$('#btnCancelarCameras').click(function () {
self.objScanners.stop();
});
});
</script>
<script type="text/javascript" src="https://cdn.ywxi.net/js/1.js" async></script>
</body>
</html>