-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (26 loc) · 1.12 KB
/
Copy pathscript.js
File metadata and controls
29 lines (26 loc) · 1.12 KB
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
// Upload form handling
document.getElementById('upload-form').addEventListener('submit', (e) => {
e.preventDefault();
const videoFile = document.getElementById('video-file').files[0];
const videoTitle = document.getElementById('video-title').value;
// TO DO: handle video upload
document.getElementById('upload-status').innerHTML = `Uploading ${videoTitle}...`;
});
// Video gallery handling
fetch('uploads/') // TO DO: fetch uploaded videos
.then(response => response.json())
.then(data => {
const videoGallery = document.getElementById('video-gallery');
data.forEach((video) => {
const videoItem = document.createElement('div');
videoItem.classList.add('video-item');
videoItem.innerHTML = `
<video width="100%" height="150" controls>
<source src="${video.url}" type="video/mp4">
</video>
<h4>${video.title}</h4>
`;
videoGallery.appendChild(videoItem);
});
})
.catch(error => console.error('Error fetching video uploads:', error));