94 lines
2.2 KiB
JavaScript
94 lines
2.2 KiB
JavaScript
|
|
async function listVideos() {
|
|
const resp = await fetch("/api/video/list/");
|
|
return await resp.json();
|
|
}
|
|
|
|
async function listDisplays() {
|
|
const resp = await fetch("/api/display/list/");
|
|
return await resp.json();
|
|
}
|
|
|
|
async function listAudioSinks() {
|
|
const resp = await fetch("/api/audio/list/");
|
|
return await resp.json();
|
|
}
|
|
|
|
function changeAudioSink(sink) {
|
|
fetch("/api/audio/change/", {
|
|
method: "POST",
|
|
body: JSON.stringify({sink}),
|
|
});
|
|
}
|
|
|
|
function showVideo(videoID, display) {
|
|
fetch("/api/video/show/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID, display: display}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function hideVideo(videoID) {
|
|
fetch("/api/video/hide/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function openVideo(link) {
|
|
const display = localStorage.getItem("display");
|
|
fetch("/api/video/open/", {
|
|
method: "POST",
|
|
body: JSON.stringify({link, display}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function openVideoInBackground(link) {
|
|
fetch("/api/video/open/hide/", {
|
|
method: "POST",
|
|
body: JSON.stringify({link}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function closeVideo(videoID) {
|
|
fetch("/api/video/close/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function pauseVideo(videoID) {
|
|
fetch("/api/video/pause/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function unpauseVideo(videoID) {
|
|
fetch("/api/video/play/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function seekVideo(videoID, second) {
|
|
fetch("/api/video/seek/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID, second: second}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
function seekVideoRelative(videoID, second) {
|
|
fetch("/api/video/seek/relative/", {
|
|
method: "POST",
|
|
body: JSON.stringify({id: videoID, second: second}),
|
|
}).then(updateUI);
|
|
}
|
|
|
|
|
|
function setVolume(volume) {
|
|
fetch("/api/video/volume/", {
|
|
method: "POST",
|
|
body: JSON.stringify({volume}),
|
|
}).then(updateUI);
|
|
} |