You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
async function main() {
|
|
const response = await fetch('/videos');
|
|
const videos = await response.json();
|
|
const videoDiv = document.getElementById('videos');
|
|
const overlayVideoDiv = document.getElementById('overlayvideos');
|
|
|
|
videoDiv.innerHTML = '';
|
|
overlayVideoDiv.innerHTML = '';
|
|
|
|
console.log(videoDiv);
|
|
|
|
for (const video of videos) {
|
|
const button = document.createElement('button');
|
|
button.textContent = video.name;
|
|
button.addEventListener('click', () => {
|
|
fetch(`/play?video=${video.path}`, { method: 'POST' });
|
|
});
|
|
console.log(button)
|
|
videoDiv.appendChild(button);
|
|
|
|
const overlayButton = document.createElement('button');
|
|
overlayButton.textContent = video.name;
|
|
overlayButton.addEventListener('click', () => {
|
|
fetch(`/select?video=${video.path}`, { method: 'POST' });
|
|
});
|
|
overlayVideoDiv.appendChild(overlayButton);
|
|
}
|
|
|
|
const res = await fetch('/projectorstatus');
|
|
const status = await res.json();
|
|
|
|
const status1 = document.getElementById('projectorstatus1');
|
|
const status2 = document.getElementById('projectorstatus2');
|
|
|
|
status1.textContent = status.status1;
|
|
status2.textContent = status.status2;
|
|
|
|
const relay1Div = document.getElementById('relay1');
|
|
const relay2Div = document.getElementById('relay2');
|
|
const relay3Div = document.getElementById('relay3');
|
|
const relay4Div = document.getElementById('relay4');
|
|
|
|
relay1Div.innerText = await (await fetch("http://10.242.84.110:8080/status/19")).text();
|
|
relay2Div.innerText = await (await fetch("http://10.242.84.110:8080/status/13")).text();
|
|
relay3Div.innerText = await (await fetch("http://10.242.84.110:8080/status/6")).text();
|
|
relay4Div.innerText = await (await fetch("http://10.242.84.110:8080/status/5")).text();
|
|
}
|
|
|
|
main();
|