undefined / index.html
hoagffff's picture
add side bar
f726e18 verified
Raw History Blame Contribute Delete
32.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Real-time RTLS Tracking</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/all.min.css') }}">
<style>
/* Sidebar styles */
.sidebar {
width: 60px;
height: 100vh;
background-color: #222;
position: fixed;
left: 0;
top: 0;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 20px;
z-index: 1000;
}
.sidebar-icon {
color: white;
font-size: 1.5em;
margin: 15px 0;
cursor: pointer;
transition: color 0.3s;
}
.sidebar-icon:hover {
color: var(--color-accent);
}
/* Shift main content to right */
.main-container {
margin-left: 60px;
width: calc(100% - 60px);
}
/* Màu nền chung */
:root {
--color-bg-main: #333;
--color-bg-panel: #444;
--color-bg-card: #555;
--color-text: white;
--color-accent: #4CAF50;
--color-danger: #d9534f;
--color-progress-bg: #666; /* Màu nền thanh tiến trình */
--color-progress-fill: var(--color-accent); /* Màu lấp đầy thanh tiến trình */
}
body {
margin: 0;
padding: 0;
background-color: var(--color-bg-main);
color: var(--color-text);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
}
/* -------------------------------------- */
/* Cấu trúc 3 cột chính */
/* -------------------------------------- */
.main-container {
display: flex;
justify-content: center;
align-items: stretch;
gap: 10px;
padding: 10px 10px 0 10px;
width: 100%;
height: 98vh;
max-width: none;
box-sizing: border-box;
}
.panel {
background-color: var(--color-bg-panel);
border-radius: 12px;
padding: 10px;
box-sizing: border-box;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* Tiêu đề cột */
.panel-title {
font-size: 1.2em;
text-align: center;
margin-bottom: 8px;
color: var(--color-accent);
}
.panel-title2 {
/* font-size: 1.0em; */
margin-bottom: 8px;
margin-top: 0px;
color: var(--color-accent);
}
/* Cột Camera */
.video-column {
width: 22%;
min-width: 180px;
max-width: 22%;
overflow-y: hidden; /* QUAN TRỌNG: Ngăn cuộn tổng thể ở đây */
/* gap: 10px; Bỏ gap để dễ kiểm soát layout */
padding-top: 5px;
padding-bottom: 0; /* Đảm bảo không có padding dưới để nút vừa khít */
/* CẤU HÌNH MỚI: Dùng flex để xếp chồng nội dung và nút */
display: flex;
flex-direction: column;
}
/* TẠO KHU VỰC CUỘN RIÊNG CHO CÁC VIDEO */
.video-column-content {
overflow-y: auto;
/* flex-grow: 1; */
/* padding: 0 5px 0 0; Padding phải để thanh cuộn không dính sát */
}
/* FIX: Layout Section - CĂN GIỮA THEO CHIỀU DỌC */
.video-layout-section {
width: 63%;
padding: 10px;
overflow-y: auto;
/* justify-content: center; FIX: Căn giữa nội dung theo chiều dọc */
align-items: center; /* Căn giữa nội dung theo chiều ngang */
}
/* Cột Controls - KHÔNG SỬA */
.control-column {
width: 15%;
min-width: 160px;
max-width: 15%;
padding-top: 5px;
}
/* -------------------------------------- */
/* Cột Camera (16:9 và Cuộn) - KHÔNG SỬA */
/* -------------------------------------- */
.video-box {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
background-color: var(--color-bg-card);
border-radius: 8px;
padding: 5px;
margin-bottom: 8px;
transition: transform 0.2s, box-shadow 0.2s;
overflow: hidden;
width: 100%;
flex-shrink: 0;
}
/* Wrapper 16:9 */
.video-aspect-ratio-container {
width: 100%;
padding-top: 56.25%;
position: relative;
}
/* Tên Camera */
.video-box h2 {
position: absolute;
top: 3px;
left: 50%;
transform: translateX(-50%);
z-index: 12;
padding: 2px 6px;
font-size: 0.8em;
color: var(--color-text);
background-color: rgba(0, 0, 0, 0.5);
border-radius: 4px;
margin: 0;
text-transform: uppercase;
}
/* Video element */
.video-box video {
position: absolute;
top: 0;
left: 0;
width: 98%;
height: 100%;
border: 2px solid var(--color-accent);
border-radius: 6px;
background-color: black;
display: block;
}
.video-controls {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
/* Nút Play/Stop - KHÔNG SỬA */
.video-controls .play-control-button {
position: relative;
background-color: rgba(0, 0, 0, 0.7);
border: 2px solid var(--color-accent);
color: var(--color-text);
font-size: 1.3em;
padding: 7px 11px;
border-radius: 50%;
opacity: 0;
transition: opacity 0.3s;
cursor: pointer;
}
.video-box.stopped .play-control-button {
opacity: 1;
}
.video-box.stopped .play-control-button i.fa-play {
display: inline;
}
.video-box.stopped .play-control-button i.fa-stop {
display: none;
}
.video-box:not(.stopped) .play-control-button i.fa-play {
display: none;
}
.video-box:not(.stopped) .play-control-button i.fa-stop {
display: inline;
}
.video-box:hover .play-control-button {
opacity: 1;
}
/* Nút Fullscreen - KHÔNG SỬA */
.full-screen-btn {
position: absolute;
right: 10px;
bottom: 10px;
top: unset;
transform: none;
z-index: 11;
opacity: 0;
transition: opacity 0.3s;
font-size: 1em !important;
background-color: rgba(0, 0, 0, 0.7);
border: none;
padding: 5px 8px;
border-radius: 50%;
}
.video-box:hover .full-screen-btn {
opacity: 1;
}
/* -------------------------------------- */
/* Layout Canvas (Giữ tỷ lệ) - KHÔNG SỬA */
/* -------------------------------------- */
.video-layout-section header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 8px;
}
.video-layout-title {
font-size: 1.5em;
margin: 0;
}
#timestamp-display,
#count-display {
font-size: 0.8em;
padding: 4px 7px;
border-radius: 4px;
background-color: rgba(255, 255, 255, 0.1);
color: white;
}
/* Layout Wrapper chịu trách nhiệm giữ tỷ lệ */
.layout-aspect-ratio-wrapper {
width: 100%;
padding-top: 57.72%;
position: relative;
margin-bottom: 8px;
flex-shrink: 0;
margin: 0 auto 8px auto;
}
/* Canvas chiếm trọn wrapper (tỷ lệ đã được cố định) */
.layout-aspect-ratio-wrapper canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 1px solid var(--color-accent);
}
/* Style cho container nút cố định ở cuối cột Camera */
.main-controls-fixed {
/* Đảm bảo chiều rộng bằng với cột */
width: 100%;
padding: 10px; /* Thêm padding để nút không bị dính vào mép */
box-sizing: border-box;
background-color: var(--color-bg-panel); /* Màu nền giống cột */
border-top: 1px solid #555; /* Đường phân cách */
/* Giữ nguyên style flex cho nút bên trong */
display: flex;
justify-content: center;
gap: 15px;
flex-shrink: 0; /* Không co lại khi cuộn */
}
/* Tinh chỉnh lại style nút để phù hợp hơn với cột hẹp */
.main-controls-fixed button {
background-color: var(--color-accent);
color: white;
border: none;
padding: 8px 15px;
text-align: center;
font-size: 0.9em;
cursor: pointer;
border-radius: 20px;
transition: background-color 0.3s, transform 0.2s;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.main-controls-fixed button#stopAllBtn {
background-color: var(--color-danger);
}
.main-controls-fixed button#stopAllBtn:hover {
background-color: #c9302c;
}
.main-controls-fixed button:hover {
background-color: #3e8e41;
transform: scale(1.05);
}
/* Scrollbar (Đã tinh chỉnh: Nhỏ và Tinh tế hơn) */
/* Bao gồm các khu vực cuộn cũ và khu vực 50/50 mới */
.video-column-content::-webkit-scrollbar,
.video-layout-section::-webkit-scrollbar,
.scrollable-half::-webkit-scrollbar,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
width: 4px;
height: 4px;
}
/* Thay đổi màu thumb (thanh kéo) */
.video-column-content::-webkit-scrollbar-thumb,
.video-layout-section::-webkit-scrollbar-thumb,
.scrollable-half::-webkit-scrollbar-thumb,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: rgba(119, 119, 119, 0.2); /* Mặc định mờ */
border-radius: 10px;
}
/* Thay đổi màu thumb khi hover */
.video-column-content::-webkit-scrollbar-thumb:hover,
.video-layout-section::-webkit-scrollbar-thumb:hover,
.scrollable-half::-webkit-scrollbar-thumb:hover,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: rgba(153, 153, 153, 0.7); /* Rõ hơn khi hover */
}
/* Giữ track trong suốt */
.video-column-content::-webkit-scrollbar-track,
.video-layout-section::-webkit-scrollbar-track,
.scrollable-half::-webkit-scrollbar-track,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: transparent;
}
/* CÁC STYLE CHO CONTROL COLUMN ĐƠN GIẢN HÓA */
.tab-content { display: flex; flex-grow: 1; overflow-y: hidden; padding: 0; height: 100%; flex-direction: column; }
.video-box2 {
flex-grow: 1;
min-height: 0;
overflow: hidden; /* Quan trọng: Ngăn cuộn tổng thể ở đây */
background-color: var(--color-bg-card);
padding: 10px;
border-radius: 8px;
border: none;
display: flex;
flex-direction: column;
gap: 10px; /* Khoảng cách giữa 2 khu vực 50/50 */
}
/* KHU VỰC 50/50 */
.scrollable-half {
height: 50%; /* Chia đôi không gian còn lại */
min-height: 0; /* Cho phép flex item co lại mà vẫn giữ được cuộn */
overflow-y: auto; /* CUỘN RIÊNG */
padding-right: 5px; /* Thêm padding để cuộn không bị dính sát mép */
box-sizing: border-box;
background-color: var(--color-bg-card); /* Màu nền riêng cho mỗi phần */
border-radius: 8px;
padding: 8px;
}
/* Loại bỏ padding và background cho video-box2 nếu đã áp dụng cho scrollable-half */
.control-column .video-box2 {
padding: 0;
background-color: transparent;
border-radius: 0;
}
#personList { list-style: none; padding: 0; margin: 0;}
.video-all-section { display: none !important; }
/* ************************************** */
/* STYLE CHO SYSTEM INFO (ĐÃ TINH CHỈNH) */
/* ************************************** */
/* Thêm đường viền hoặc nền nhẹ để phân tách 2 khu vực rõ ràng hơn */
#tracking-content {
border-bottom: 2px solid var(--color-bg-panel);
margin-bottom: 10px;
}
/* Giảm padding cho khu vực scrollable, vì padding đã có trong .scrollable-half */
.system-info {
font-size: 0.9em;
padding-top: 0;
}
.system-info p {
font-size: 13px;
/* margin: 8px 0; */
margin-top: 12px;
padding: 5px 0;
border-top: 1px solid #444;
}
.system-info h4 {
font-size: 1.1em;
margin-top: 10px;
margin-bottom: 5px;
color: var(--color-accent);
border-bottom: 1px dashed #777;
padding-bottom: 3px;
}
/* Style cho Thanh tiến trình */
.progress-bar-container {
height: 10px;
width: 100%;
background-color: var(--color-progress-bg);
border-radius: 3px;
overflow: hidden;
margin-top: 3px;
display: flex;
align-items: center;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.progress-bar {
height: 100%;
background-color: var(--color-progress-fill);
width: 0%;
transition: width 0.5s ease-out;
}
.progress-bar.danger {
background-color: var(--color-danger);
}
/* Cấu trúc cho các dòng không có progress bar */
.system-info p:not(:has(.progress-bar-container)) {
display: flex;
justify-content: space-between;
align-items: center;
}
/* --- VỊ TRÍ MỚI: Thêm vào cuối thẻ <style> --- */
/* Cấu trúc cho Event Panel */
.video-container {
/* height: 74vh; */
flex-direction: column;
display: flex;
width: 100%;
}
.event-container {
background-color: var(--color-bg-card);
border-radius: 12px;
padding: 10px;
box-sizing: border-box;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
height: 25vh;
width: 100%;
flex-grow: 1;
}
/* Event List */
#event-list-scroll {
flex-grow: 1;
overflow-y: auto; /* CUỘN CHO DANH SÁCH CẢNH BÁO */
padding-right: 5px;
margin-top: 5px;
}
#event-list {
list-style: none;
padding: 0;
margin: 0;
}
/* Vị trí cũ: .event-item */
.event-item {
padding: 6px 8px;
margin-top: 1px;
margin-bottom: 4px;
border-radius: 6px;
font-size: 0.9em;
transition: background-color 0.3s;
/* 📌 SỬA ĐỔI: BỐ CỤC CHÍNH (Một dòng ngang) */
display: flex;
flex-direction: row; /* Xếp ngang (Mặc định, nhưng ghi rõ) */
align-items: center; /* Căn giữa theo chiều dọc */
line-height: 1.3;
/* wi
dth: 100%; Chiếm hết chiều ngang */
/* NGĂN CHẶN TOÀN BỘ NỘI DUNG CUỘN XUỐNG DÒNG */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alert-message {
flex-shrink: 1; /* Cho phép co lại nếu cần */
margin-right: 10px;
overflow: hidden;
text-overflow: ellipsis;
/* Giữ lại white-space: nowrap */
}
.status-icon {
margin-right: 8px;
}
.person-id, .status-text {
flex-shrink: 0; /* Đảm bảo Person ID và Status không bao giờ bị cắt/ẩn */
font-weight: bold;
margin-right: 25px;
}
/* 📌 CÁC THÔNG TIN THỜI GIAN/THỜI LƯỢNG (Phải luôn hiển thị) */
.alert-time, .alert-duration {
flex-shrink: 0; /* KHÔNG BAO GIỜ CHO PHÉP CO */
margin-left: 5px;
font-size: 0.8em;
color: #ccc;
}
/* Đảm bảo thời gian không bị co lại */
.alert-time, .alert-duration {
flex-shrink: 0;
margin-left: 10px;
}
/* Màu cho cảnh báo DEPARTED */
.event-item.departed {
background-color: rgba(217, 83, 79, 0.2); /* Đỏ nhạt */
border-left: 5px solid var(--color-danger);
}
/* Màu cho thông báo RETURNED */
.event-item.returned {
background-color: rgba(76, 175, 80, 0.2); /* Xanh lá nhạt */
border-left: 5px solid var(--color-accent);
}
.event-item.ongoing {
background-color: rgba(255, 165, 0, 0.3); /* Nền cam nhạt */
border-left: 5px solid orange; /* Đường viền cam */
box-shadow: 0 0 5px orange; /* Hiệu ứng nhẹ */
}
@keyframes alert-flash {
0% {
background-color: var(--color-danger); /* Bắt đầu bằng màu đỏ đậm */
opacity: 1;
}
50% {
background-color: rgba(255, 255, 255, 0.2); /* Chuyển sang màu nền nhẹ */
opacity: 0.9;
}
100% {
background-color: rgba(217, 83, 79, 0.2); /* Quay về màu nền Alert thông thường */
opacity: 1;
}
}
/* 2. Áp dụng hiệu ứng và đảm bảo nó chạy hết và dừng lại */
.event-item.new-alert {
animation: alert-flash 0.2s ease-out 4; /* Chạy 1.5 giây và chỉ 1 lần */
}
</style>
</head>
<body>
<div class="sidebar">
<i class="fas fa-home sidebar-icon" title="Dashboard"></i>
<i class="fas fa-video sidebar-icon" title="Cameras"></i>
<i class="fas fa-map sidebar-icon" title="Layout"></i>
<i class="fas fa-bell sidebar-icon" title="Alerts"></i>
<i class="fas fa-cog sidebar-icon" title="Settings"></i>
</div>
<div class="main-container">
<div class="panel video-column">
<h3 class="panel-title">CAMERA FEEDS</h3>
<div class="video-column-content">
<div class="video-box stopped" id="cam-box-d15">
<h2>CAMERA D15</h2>
<div class="video-aspect-ratio-container">
<video id="video-d15" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d15', 'video-d15')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d15')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d19">
<h2>CAMERA D19</h2>
<div class="video-aspect-ratio-container">
<video id="video-d19" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d19', 'video-d19')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d19')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d28">
<h2>CAMERA D28</h2>
<div class="video-aspect-ratio-container">
<video id="video-d28" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d28', 'video-d28')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d28')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d25">
<h2>CAMERA D25</h2>
<div class="video-aspect-ratio-container">
<video id="video-d25" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d25', 'video-d25')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d25')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d58">
<h2>CAMERA D58</h2>
<div class="video-aspect-ratio-container">
<video id="video-d58" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d58', 'video-d58')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d58')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d39">
<h2>CAMERA D39</h2>
<div class="video-aspect-ratio-container">
<video id="video-d39" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d39', 'video-d39')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d39')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
</div>
<div class="main-controls-fixed">
<button id="viewAllBtn" onclick="viewAllCameras()"><i class="fas fa-play"></i> View Cameras</button>
<button id="stopAllBtn" onclick="stopAllCameras()"><i class="fas fa-stop"></i> Stop Cameras</button>
</div>
</div>
<div class="panel video-layout-section">
<div class="video-container">
<header>
<h3 class="video-layout-title">LINE LAYOUT</h3>
<div>
<a id="count-display">--</a>
<a id="timestamp-display">--</a>
</div>
</header>
<div class="layout-aspect-ratio-wrapper">
<canvas id="layoutCanvas" class="video-layout-canvas" width="1920" height="1280"></canvas>
</div>
</div>
<div class="event-container">
<h4 class="panel-title2" style="margin-bottom: 0; color: white;">EVENTS / ALERTS</h4>
<div id="event-list-scroll">
<ul id="event-list">
</ul>
</div>
</div>
</div>
<div class="panel control-column">
<h3 class="panel-title">CONTROLS / SYSTEM</h3>
<div id="control-content" class="tab-content active">
<div class="video-box2">
<div id="tracking-content" class="scrollable-half">
<h4>Tracked Subjects</h4>
<select id="timeSelector" style="margin-bottom:10px; width: 100%; padding: 5px; border-radius: 5px; background-color: var(--color-bg-panel); color: var(--color-text); border: none;">
<option value="1">1 minute ago</option>
<option value="3" selected>3 minutes ago</option>
<option value="5">5 minutes ago</option>
<option value="10">10 minutes ago</option>
<option value="30">30 minutes ago</option>
<option value="60">1 hour ago</option>
</select>
<button onclick="enableLiveMode()" style="margin-bottom:10px; background-color: var(--color-danger); border-radius: 5px; padding: 8px; width: 100%; border: none; color: white; cursor: pointer;">🔴 Live Mode</button>
<ul id="personList"></ul>
</div>
<div id="system-content" class="scrollable-half">
<h4>System Health</h4>
<div class="system-info">
<p>CPU Usage<span id="cpu-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="cpu-percent-bar"></div>
</div>
</p>
<p>RAM Usage<span id="ram-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="ram-percent-bar"></div>
</div>
</p>
<h4>GPU Metrics</h4>
<p>GPU Name<span id="gpu-name">--</span></p>
<!-- <p>GPU Usage<span id="gpu-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="gpu-percent-bar"></div>
</div>
</p> -->
<p>GPU Usage<span><span id="gpu-mem-used">-- GB</span> / <span id="gpu-mem-total">-- GB</span> (<span id="gpu-mem-percent-text">-- %</span>)</span>
<div class="progress-bar-container">
<div class="progress-bar" id="gpu-mem-percent-bar"></div>
</div>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="{{ url_for('static', filename='js/socket.io.js') }}">
// Initialize socket listeners
app.socket.on('update_positions', UI.handlePositionUpdates);
app.socket.on('system_update', System.handleSystemUpdate);
app.socket.on('update_alerts_list', Alerts.handleAlertsUpdate);
</script>
<script src="{{ url_for('static', filename='js/reader.js') }}"></script>
<script src="{{ url_for('static', filename='js/hls.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
<script src="{{ url_for('static', filename='js/ui.js') }}"></script>
<script src="{{ url_for('static', filename='js/alerts.js') }}"></script>
<script src="{{ url_for('static', filename='js/system.js') }}"></script>
<script src="{{ url_for('static', filename='js/webrtc.js') }}"></script>
<script>
// Configuration constants
const CONFIG = {
WEBRTC_STREAMS: {
'd15': "http://10.62.162.104:3003/D15/whep",
'd19': "http://10.62.162.104:3003/D19/whep",
'd25': "http://10.62.162.104:3003/D25/whep",
'd28': "http://10.62.162.104:3003/D28/whep",
'd58': "http://10.62.162.104:3003/D58/whep"
},
LAYOUT_IMAGE: "{{ url_for('static', filename='cua5.png') }}",
ORIGINAL_WIDTH: 1920,
ORIGINAL_HEIGHT: 1280,
MAX_EVENTS: 100,
CALIBRATION_FILE: '/static/calibration.json'
};
// Initialize core modules
const app = {
init: function() {
this.socket = io();
this.canvas = document.getElementById('layoutCanvas');
this.ctx = this.canvas.getContext('2d');
this.layoutImage = new Image();
this.layoutImage.src = CONFIG.LAYOUT_IMAGE;
this.webrtcPlayers = {};
this.cameraIDs = Object.keys(CONFIG.WEBRTC_STREAMS);
this.liveMode = true;
// Initialize modules
UI.init(this);
WebRTC.init(this);
Alerts.init(this);
System.init(this);
// Load initial data
this.loadInitialData();
},
loadInitialData: function() {
UI.loadCalibrationData(CONFIG.CALIBRATION_FILE);
Alerts.loadInitialAlerts(10);
System.startMonitoring();
}
};
// Start the application
document.addEventListener('DOMContentLoaded', function() {
app.init();
});
</script>
</body>
</html>