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
|
// 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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user