Fix dashboard video: pindah event listener video-toggle setelah load camera data, tambah logging

This commit is contained in:
mwpn
2025-12-18 13:49:47 +07:00
parent 1bde05556d
commit c29f0a1cb5

View File

@@ -707,17 +707,7 @@ function setupFilters() {
}); });
} }
// Setup video toggle button // Video toggle button akan di-setup di DOMContentLoaded setelah load camera data
const toggleBtn = document.getElementById('video-toggle');
if (toggleBtn) {
toggleBtn.addEventListener('click', () => {
if (isVideoPlaying) {
stopVideo();
} else {
startVideo();
}
});
}
} }
function initCharts() { function initCharts() {
@@ -782,6 +772,18 @@ document.addEventListener('DOMContentLoaded', async () => {
await loadLocationsForCamera(); await loadLocationsForCamera();
await loadGatesForCamera(); 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 // Cek lokasi awal untuk show/hide video
showVideoPanel(state.locationCode); showVideoPanel(state.locationCode);