-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (36 loc) · 989 Bytes
/
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
<!DOCTYPE HTML>
<html>
<head>
<title>Facial Recognition Test</title>
<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" charset="utf-8">
var ws_path = 'ws://192.168.100.164:8000';
//alert(ws_path);
var ws = new WebSocket (ws_path);
//alert(ws);
ws.onopen = function () {
params = JSON.stringify({command : 'video_feed', camera_name: 'camera_1'});
ws.send(params);
};
const reader = new FileReader();
// This fires after the blob has been read/loaded.
reader.addEventListener('loadend', (e) => {
const text = e.srcElement.result;
document.getElementById("live-video").src = 'data:image/jpg;base64,' + String(text);
});
// Start reading the blob as text.
ws.onmessage = function (msg) {
reader.readAsText(msg.data);
params = JSON.stringify({command: 'video_feed', camera_name: 'camera_1'});
ws.send(params);
};
ws.onerror = function (e) {
console.log(e);
ws.send(1);
};
</script>
</head>
<body>
<img id="live-video"/>
</body>
</html>