File size: 899 Bytes
f470fc6
fe5c8c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f470fc6
fe5c8c5
 
 
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
async function loadVideos() {
  try {
    const response = await fetch("/static-proxy?url=https%3A%2F%2Fdatasets-server.huggingface.co%2Frows%3Fdataset%3Dmaringetxway%2Fwinners%26amp%3Bconfig%3Ddefault%26amp%3Bsplit%3Dtrain%26amp%3Boffset%3D0%26amp%3Blimit%3D100%26quot%3B%3C%2Fspan%3E)%3B
    const data = await response.json();

    const container = document.getElementById("videoContainer");

    data.rows.forEach(row => {
      const videoUrl = row.row.video;  // Assumes each row has a `video` field
      if (videoUrl) {
        const video = document.createElement("video");
        video.src = videoUrl;
        video.controls = true;
        video.autoplay = false;
        video.muted = true;
        video.loop = false;
        video.playsInline = true;
        video.className = "w-full mb-4 rounded-lg shadow-md"; // Optional styling
        container.appendChild(video);
      }
    });
  } catch (error) {
    console.error("Error loading videos:", error);
  }
}

loadVideos();