/** * @returns {Promise<{server_ip: string, server_port: number}>} */ async function getServerConfig() { const response = await fetch('/api/ip'); return await response.json(); } async function getMediaStat() { const response = await fetch('/api/stats'); return await response.json(); } async function toggleStatHidden() { const section_stat = document.getElementById("stat") section_stat.hidden = !section_stat.hidden } function openPopup() { document.getElementById("popup").style.display = "block"; } function closePopup() { document.getElementById("popup").style.display = "none"; } getMediaStat() .then(data => { console.log("Antwort von /api/stats:", data); // Debug-Ausgabe if (!data || typeof data !== 'object' || !data.videos || typeof data.videos !== 'object') { throw new Error("Ungültiges Antwortformat oder fehlende 'videos'-Eigenschaft"); } const stat_Container = document.getElementById('stat'); Object.keys(data.videos).forEach(key => { const video = data.videos[key]; const card = document.createElement('div'); card.className = 'video-card'; card.id = key card.innerHTML = `

${video.source_file_name}

Quelle: ${video.source_file}
Dauer: ${video.source_duration}
Größe: ${video.source_size}
FPS: ${video.source_frame_rate}
Frames: ${video.source_frames_total}
Start: ${video.process_start}
Ende: ${video.process_end}
Status: ${video.status}
Zeit: ${video.process_time}
Größe (Ziel): ${video.target_size}
FPS (aktuell): ${video.stat_fps}
Bitrate: ${video.stat_bitrate}
Speed: ${video.stat_speed}
`; stat_Container.appendChild(card) }); }) .catch(error => { console.error('Fehler beim Abrufen der Medienstatistik:', error); });