-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
42 lines (40 loc) · 1.09 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Raspberry Pi Camera</title>
<script src="/socket.io/socket.io.js"></script>
<style type="text/css">
body {
background-color: #0b97c4;
}
#container {
width: 50%;
margin: 0 auto;
}
#container p {
width: 100%;
text-align: center;
}
</style>
<script type="text/javascript">
document.onreadystatechange = function () {
var state = document.readyState
if (state == 'complete') {
var imageCount = 0;
var socket = io();
socket.on('image', function(message) {
document.getElementById("image").src = 'data:image/jpg;base64,' + message;
document.getElementById("caption").innerHTML = 'Image #' + ++imageCount;
});
}
}
</script>
</head>
<body>
<div id="container">
<img width="640" height="480" id="image">
<p id="caption">Image #0</p>
</div>
</body>
</html>