-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
102 lines (88 loc) · 4.46 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
101
102
<!DOCTYPE html>
<html>
<head>
<title>Astro Pi Cam - Live</title>
<meta charset="utf-8"/>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google" content="notranslate" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="topnav">
<a class="active" href="index.html">Live</a>
<a href="archive.php">Archive</a>
<a href="tools.php">Tools</a>
<a class="shutdown" href="shutdown.html">Shutdown</a>
<a id="topbarVersion" style="float:right;">AstroPiCam V1.0</a>
</div>
<div style="padding-left:16px">
<h2>Telescope Live Footage</h2>
<p>Omegon N 130/920 EQ-2</p>
<iframe id="liveViewFrame" src="http://192.168.178.2:8001/" title="Live View" width="98%" style="margin-left: -5px;" scrolling="no" frameBorder="0"></iframe>
<br>
<button class="button button1" id="captureImageButton" onclick="captureImage()">Capture image</button>
<button class="button button1" id="captureHQVideoButton" onclick="captureHQVideoButton()">Capture video</button>
<br><i id="infotext" style="font-size:75%;"></i>
︎
<script>
if (document.getElementById("liveViewFrame").clientWidth > 800) {
document.getElementById("liveViewFrame").width = "50%";
}
document.getElementById("liveViewFrame").height = (document.getElementById("liveViewFrame").clientWidth * 72 / 100) + "px";
function captureHQVideoButton() {
var captureHQVideoButton = document.getElementById("captureHQVideoButton");
if (captureHQVideoButton.innerText == "Capture video") {
xmlReq = new XMLHttpRequest();
xmlReq.open("POST","captureHQVideo.php?action=start",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
captureHQVideoButton.innerText = "Stop video";
captureHQVideoButton.classList.remove('button1');
captureHQVideoButton.classList.add('button2');
document.getElementById("infotext").innerHTML = "Capturing and processing high quality video...";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 25000);
} else {
xmlReq = new XMLHttpRequest();
xmlReq.open("POST","captureHQVideo.php?action=stop",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
captureHQVideoButton.innerText = "Capture video";
captureHQVideoButton.classList.remove('button2');
captureHQVideoButton.classList.add('button1');
setTimeout(function() {
xmlReq2 = new XMLHttpRequest();
xmlReq2.open("POST","restartStream.php",true);
xmlReq2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq2.send();
setTimeout(function() {
location.reload();
}, 2750);
}, 600);
document.getElementById("infotext").innerText = "HQ Video footage captured, processing in work. Further stacking required for image quality improvements.";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
}
function captureImage() {
xmlReq = new XMLHttpRequest();
xmlReq.onreadystatechange = function() {
if (xmlReq.readyState == XMLHttpRequest.DONE) {
document.getElementById("infotext").innerHTML = "Image saved as \"" + xmlReq.response + "\". You can download it in the <a href='/archive.php'>archive</a>.";
}
}
xmlReq.open("POST","captureImage.php",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
document.getElementById("infotext").innerHTML = "Capturing and processing image...";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
</script>
</div>
</body>
</html>