async function loadVideos() { | |
try { | |
const response = await fetch("https://datasets-server.huggingface.co/rows?dataset=maringetxway/all-winners&config=default&split=train&offset=0&limit=30"); | |
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(); | |