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.
18 lines
457 B
JavaScript
18 lines
457 B
JavaScript
async function main() {
|
|
const response = await fetch('/videos');
|
|
const videos = await response.json();
|
|
const videoDiv = document.getElementById('videos');
|
|
|
|
videoDiv.innerHTML = '';
|
|
|
|
for (const video of videos) {
|
|
const button = document.createElement('button');
|
|
button.textContent = video.name;
|
|
button.addEventListener('click', () => {
|
|
fetch(`/play?video=${video.path}`, { method: 'POST' });
|
|
});
|
|
videoDiv.appendChild(button);
|
|
}
|
|
}
|
|
|
|
main(); |