-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
40 lines (40 loc) · 980 Bytes
/
index.html
File metadata and controls
40 lines (40 loc) · 980 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Clear</title>
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline';"
/>
</head>
<body>
<h1>Welcome to Clear!</h1>
<div
id="camdemo"
style="width: 320px; height: 240px; text-align: center; margin: 0 auto;"
></div>
<br />
<div style="text-align: center;">
<input type="button" id="start" value="Start / Shut down camera" />
</div>
</body>
<script>
let enabled = false;
const WebCamera = require("webcamjs");
document.getElementById("start").addEventListener(
"click",
function () {
if (!enabled) {
enabled = true;
WebCamera.attach("#camdemo");
console.log("The camera has been started");
} else {
enabled = false;
WebCamera.reset();
console.log("The camera has been disabled");
}
},
false
);
</script>
</html>