From c29f0a1cb577d092d964d57f536d273bb40832ed Mon Sep 17 00:00:00 2001 From: mwpn Date: Thu, 18 Dec 2025 13:49:47 +0700 Subject: [PATCH] Fix dashboard video: pindah event listener video-toggle setelah load camera data, tambah logging --- public/dashboard/js/dashboard.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/public/dashboard/js/dashboard.js b/public/dashboard/js/dashboard.js index e4d863a..67135cc 100644 --- a/public/dashboard/js/dashboard.js +++ b/public/dashboard/js/dashboard.js @@ -707,17 +707,7 @@ function setupFilters() { }); } - // Setup video toggle button - const toggleBtn = document.getElementById('video-toggle'); - if (toggleBtn) { - toggleBtn.addEventListener('click', () => { - if (isVideoPlaying) { - stopVideo(); - } else { - startVideo(); - } - }); - } + // Video toggle button akan di-setup di DOMContentLoaded setelah load camera data } function initCharts() { @@ -782,6 +772,18 @@ document.addEventListener('DOMContentLoaded', async () => { await loadLocationsForCamera(); await loadGatesForCamera(); + // Setup video toggle button SETELAH load camera data + const toggleBtn = document.getElementById('video-toggle'); + if (toggleBtn) { + toggleBtn.addEventListener('click', () => { + if (isVideoPlaying) { + stopVideo(); + } else { + startVideo(); + } + }); + } + // Cek lokasi awal untuk show/hide video showVideoPanel(state.locationCode);