Fix dashboard video: pindah event listener video-toggle setelah load camera data, tambah logging
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user