-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.html
More file actions
35 lines (32 loc) · 765 Bytes
/
stream.html
File metadata and controls
35 lines (32 loc) · 765 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Stream</title>
</head>
<body onload="receive()">
<img id="image">
</body>
<script>
function receive() {
let xmlhr = new XMLHttpRequest();
xmlhr.open("VIDEO", window.location.href + "stream.py");
xmlhr.send();
xmlhr.onload = function () {
document.getElementById("image").src = "data:image/png;base64," + xmlhr.response;
setTimeout(receive, 75);
}
xmlhr.onerror = function () {
alert("An error has occurred");
setTimeout(receive, 1500);
}
}
</script>
<style>
#image {
display: block;
margin-left: auto;
margin-right: auto;
width: 120vh;
}
</style>
</html>