video_manager.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>RTSP视频流管理系统</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. body {
  14. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  15. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  16. min-height: 100vh;
  17. padding: 20px;
  18. }
  19. .container {
  20. max-width: 1400px;
  21. margin: 0 auto;
  22. }
  23. .header {
  24. background: white;
  25. padding: 30px;
  26. border-radius: 10px;
  27. box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  28. margin-bottom: 30px;
  29. }
  30. h1 {
  31. color: #333;
  32. margin-bottom: 10px;
  33. }
  34. .subtitle {
  35. color: #666;
  36. font-size: 14px;
  37. }
  38. .stats {
  39. display: grid;
  40. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  41. gap: 20px;
  42. margin-bottom: 30px;
  43. }
  44. .stat-card {
  45. background: white;
  46. padding: 20px;
  47. border-radius: 10px;
  48. box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  49. }
  50. .stat-card h3 {
  51. color: #666;
  52. font-size: 14px;
  53. margin-bottom: 10px;
  54. }
  55. .stat-card .value {
  56. color: #333;
  57. font-size: 32px;
  58. font-weight: bold;
  59. }
  60. .content {
  61. background: white;
  62. padding: 30px;
  63. border-radius: 10px;
  64. box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  65. }
  66. .tabs {
  67. display: flex;
  68. gap: 10px;
  69. margin-bottom: 20px;
  70. border-bottom: 2px solid #eee;
  71. }
  72. .tab {
  73. padding: 10px 20px;
  74. background: none;
  75. border: none;
  76. cursor: pointer;
  77. font-size: 16px;
  78. color: #666;
  79. transition: all 0.3s;
  80. }
  81. .tab.active {
  82. color: #667eea;
  83. border-bottom: 2px solid #667eea;
  84. margin-bottom: -2px;
  85. }
  86. .tab-content {
  87. display: none;
  88. }
  89. .tab-content.active {
  90. display: block;
  91. }
  92. .timestamp-list {
  93. display: grid;
  94. gap: 15px;
  95. }
  96. .timestamp-item {
  97. background: #f8f9fa;
  98. padding: 20px;
  99. border-radius: 8px;
  100. border-left: 4px solid #667eea;
  101. }
  102. .timestamp-header {
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: center;
  106. margin-bottom: 10px;
  107. }
  108. .timestamp-name {
  109. font-size: 18px;
  110. font-weight: bold;
  111. color: #333;
  112. }
  113. .timestamp-info {
  114. color: #666;
  115. font-size: 14px;
  116. }
  117. .btn {
  118. padding: 8px 16px;
  119. border: none;
  120. border-radius: 5px;
  121. cursor: pointer;
  122. font-size: 14px;
  123. transition: all 0.3s;
  124. }
  125. .btn-primary {
  126. background: #667eea;
  127. color: white;
  128. }
  129. .btn-primary:hover {
  130. background: #5568d3;
  131. }
  132. .btn-danger {
  133. background: #dc3545;
  134. color: white;
  135. }
  136. .btn-danger:hover {
  137. background: #c82333;
  138. }
  139. .btn-success {
  140. background: #28a745;
  141. color: white;
  142. }
  143. .btn-success:hover {
  144. background: #218838;
  145. }
  146. .video-grid {
  147. display: grid;
  148. grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  149. gap: 20px;
  150. margin-top: 15px;
  151. }
  152. .video-card {
  153. background: white;
  154. border: 1px solid #ddd;
  155. border-radius: 8px;
  156. padding: 15px;
  157. transition: all 0.3s;
  158. }
  159. .video-card:hover {
  160. box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  161. }
  162. .video-name {
  163. font-weight: bold;
  164. color: #333;
  165. margin-bottom: 8px;
  166. }
  167. .video-info {
  168. font-size: 12px;
  169. color: #666;
  170. margin-bottom: 5px;
  171. }
  172. .loading {
  173. text-align: center;
  174. padding: 40px;
  175. color: #666;
  176. }
  177. .error {
  178. background: #f8d7da;
  179. color: #721c24;
  180. padding: 15px;
  181. border-radius: 5px;
  182. margin-bottom: 20px;
  183. }
  184. .success {
  185. background: #d4edda;
  186. color: #155724;
  187. padding: 15px;
  188. border-radius: 5px;
  189. margin-bottom: 20px;
  190. }
  191. .refresh-btn {
  192. float: right;
  193. margin-bottom: 20px;
  194. }
  195. /* 视频播放器样式 */
  196. .video-modal {
  197. display: none;
  198. position: fixed;
  199. top: 0;
  200. left: 0;
  201. width: 100%;
  202. height: 100%;
  203. background: rgba(0, 0, 0, 0.9);
  204. z-index: 1000;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .video-modal.active {
  209. display: flex;
  210. }
  211. .video-modal-content {
  212. background: white;
  213. border-radius: 10px;
  214. padding: 20px;
  215. max-width: 90%;
  216. max-height: 90%;
  217. position: relative;
  218. }
  219. .video-modal-header {
  220. display: flex;
  221. justify-content: space-between;
  222. align-items: center;
  223. margin-bottom: 15px;
  224. }
  225. .video-modal-title {
  226. font-size: 18px;
  227. font-weight: bold;
  228. color: #333;
  229. }
  230. .close-btn {
  231. background: #dc3545;
  232. color: white;
  233. border: none;
  234. border-radius: 50%;
  235. width: 35px;
  236. height: 35px;
  237. cursor: pointer;
  238. font-size: 20px;
  239. line-height: 1;
  240. transition: all 0.3s;
  241. }
  242. .close-btn:hover {
  243. background: #c82333;
  244. transform: rotate(90deg);
  245. }
  246. .video-player {
  247. width: 100%;
  248. max-width: 1200px;
  249. max-height: 70vh;
  250. background: #000;
  251. border-radius: 5px;
  252. }
  253. .video-info-panel {
  254. margin-top: 15px;
  255. padding: 15px;
  256. background: #f8f9fa;
  257. border-radius: 5px;
  258. }
  259. .video-info-item {
  260. display: flex;
  261. justify-content: space-between;
  262. margin-bottom: 8px;
  263. font-size: 14px;
  264. }
  265. .video-info-label {
  266. color: #666;
  267. font-weight: bold;
  268. }
  269. .video-info-value {
  270. color: #333;
  271. }
  272. .btn-play {
  273. background: #28a745;
  274. color: white;
  275. margin-right: 5px;
  276. }
  277. .btn-play:hover {
  278. background: #218838;
  279. }
  280. </style>
  281. </head>
  282. <body>
  283. <div class="container">
  284. <div class="header">
  285. <h1>🎥 RTSP视频流管理系统</h1>
  286. <p class="subtitle">查看和管理您的视频流录制文件</p>
  287. </div>
  288. <div class="stats" id="stats">
  289. <div class="stat-card">
  290. <h3>时间戳目录</h3>
  291. <div class="value" id="timestamp-count">-</div>
  292. </div>
  293. <div class="stat-card">
  294. <h3>视频总数</h3>
  295. <div class="value" id="video-count">-</div>
  296. </div>
  297. <div class="stat-card">
  298. <h3>总大小</h3>
  299. <div class="value" id="total-size">-</div>
  300. </div>
  301. </div>
  302. <div class="content">
  303. <div id="message"></div>
  304. <button class="btn btn-success refresh-btn" onclick="loadData()">🔄 刷新</button>
  305. <div class="tabs">
  306. <button class="tab active" onclick="switchTab('timestamps')">时间戳目录</button>
  307. <button class="tab" onclick="switchTab('videos')">所有视频</button>
  308. <button class="tab" onclick="switchTab('reports')">轮询报告</button>
  309. </div>
  310. <div id="timestamps-tab" class="tab-content active">
  311. <div class="loading">加载中...</div>
  312. </div>
  313. <div id="videos-tab" class="tab-content">
  314. <div class="loading">加载中...</div>
  315. </div>
  316. <div id="reports-tab" class="tab-content">
  317. <div class="loading">加载中...</div>
  318. </div>
  319. </div>
  320. </div>
  321. <!-- 视频播放器模态框 -->
  322. <div id="video-modal" class="video-modal">
  323. <div class="video-modal-content">
  324. <div class="video-modal-header">
  325. <div class="video-modal-title" id="video-title">视频播放</div>
  326. <button class="close-btn" onclick="closeVideoPlayer()">×</button>
  327. </div>
  328. <video id="video-player" class="video-player" controls>
  329. 您的浏览器不支持视频播放。
  330. </video>
  331. <div class="video-info-panel" id="video-details">
  332. <!-- 视频详细信息将在这里显示 -->
  333. </div>
  334. </div>
  335. </div>
  336. <script>
  337. const API_BASE = 'http://localhost:8080';
  338. function switchTab(tab) {
  339. document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
  340. document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
  341. event.target.classList.add('active');
  342. document.getElementById(tab + '-tab').classList.add('active');
  343. }
  344. function formatBytes(bytes) {
  345. if (bytes === 0) return '0 B';
  346. const k = 1024;
  347. const sizes = ['B', 'KB', 'MB', 'GB'];
  348. const i = Math.floor(Math.log(bytes) / Math.log(k));
  349. return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
  350. }
  351. function showMessage(message, type = 'success') {
  352. const messageDiv = document.getElementById('message');
  353. messageDiv.innerHTML = `<div class="${type}">${message}</div>`;
  354. setTimeout(() => {
  355. messageDiv.innerHTML = '';
  356. }, 3000);
  357. }
  358. function playVideo(videoPath, filename, fileSize, createdTime, timestampDir, streamIndex) {
  359. const modal = document.getElementById('video-modal');
  360. const player = document.getElementById('video-player');
  361. const title = document.getElementById('video-title');
  362. const details = document.getElementById('video-details');
  363. // 设置视频标题
  364. title.textContent = `▶ ${filename}`;
  365. // 设置视频源 - 使用相对路径
  366. const relativePath = `${timestampDir}/${filename}`;
  367. const videoUrl = `${API_BASE}/videos/${encodeURIComponent(relativePath)}`;
  368. console.log('设置视频源:', videoUrl);
  369. player.src = videoUrl;
  370. player.load();
  371. // 显示视频详细信息
  372. details.innerHTML = `
  373. <div class="video-info-item">
  374. <span class="video-info-label">📁 文件名:</span>
  375. <span class="video-info-value">${filename}</span>
  376. </div>
  377. <div class="video-info-item">
  378. <span class="video-info-label">📊 文件大小:</span>
  379. <span class="video-info-value">${formatBytes(fileSize)}</span>
  380. </div>
  381. <div class="video-info-item">
  382. <span class="video-info-label">🕒 创建时间:</span>
  383. <span class="video-info-value">${createdTime}</span>
  384. </div>
  385. <div class="video-info-item">
  386. <span class="video-info-label">📂 时间戳目录:</span>
  387. <span class="video-info-value">${timestampDir}</span>
  388. </div>
  389. <div class="video-info-item">
  390. <span class="video-info-label">📍 流索引:</span>
  391. <span class="video-info-value">${streamIndex}</span>
  392. </div>
  393. <div class="video-info-item">
  394. <span class="video-info-label">📍 完整路径:</span>
  395. <span class="video-info-value">${videoPath}</span>
  396. </div>
  397. `;
  398. // 显示模态框
  399. modal.classList.add('active');
  400. // 尝试自动播放
  401. player.play().catch(err => {
  402. console.log('自动播放失败,需要用户交互:', err);
  403. });
  404. }
  405. function closeVideoPlayer() {
  406. const modal = document.getElementById('video-modal');
  407. const player = document.getElementById('video-player');
  408. // 暂停播放
  409. player.pause();
  410. player.src = '';
  411. // 隐藏模态框
  412. modal.classList.remove('active');
  413. }
  414. // 点击模态框背景关闭
  415. document.getElementById('video-modal').addEventListener('click', function(e) {
  416. if (e.target === this) {
  417. closeVideoPlayer();
  418. }
  419. });
  420. // ESC键关闭
  421. document.addEventListener('keydown', function(e) {
  422. if (e.key === 'Escape') {
  423. closeVideoPlayer();
  424. }
  425. });
  426. async function loadStats() {
  427. try {
  428. const [timestampsRes, videosRes] = await Promise.all([
  429. fetch(`${API_BASE}/api/timestamps`),
  430. fetch(`${API_BASE}/api/videos`)
  431. ]);
  432. const timestamps = await timestampsRes.json();
  433. const videos = await videosRes.json();
  434. document.getElementById('timestamp-count').textContent = timestamps.count;
  435. document.getElementById('video-count').textContent = videos.count;
  436. const totalSize = videos.videos.reduce((sum, video) => sum + video.file_size, 0);
  437. document.getElementById('total-size').textContent = formatBytes(totalSize);
  438. } catch (error) {
  439. console.error('加载统计数据失败:', error);
  440. }
  441. }
  442. async function loadTimestamps() {
  443. const container = document.getElementById('timestamps-tab');
  444. container.innerHTML = '<div class="loading">加载中...</div>';
  445. try {
  446. const response = await fetch(`${API_BASE}/api/timestamps`);
  447. const data = await response.json();
  448. if (data.count === 0) {
  449. container.innerHTML = '<div class="loading">暂无时间戳目录</div>';
  450. return;
  451. }
  452. let html = '<div class="timestamp-list">';
  453. for (const ts of data.timestamps) {
  454. html += `
  455. <div class="timestamp-item">
  456. <div class="timestamp-header">
  457. <div>
  458. <div class="timestamp-name">📁 ${ts.timestamp}</div>
  459. <div class="timestamp-info">
  460. ${ts.video_count} 个视频 | ${formatBytes(ts.total_size)}
  461. </div>
  462. </div>
  463. <div>
  464. <button class="btn btn-primary" onclick="viewTimestamp('${ts.timestamp}')">查看</button>
  465. <button class="btn btn-danger" onclick="deleteTimestamp('${ts.timestamp}')">删除</button>
  466. </div>
  467. </div>
  468. <div id="videos-${ts.timestamp}"></div>
  469. </div>
  470. `;
  471. }
  472. html += '</div>';
  473. container.innerHTML = html;
  474. } catch (error) {
  475. container.innerHTML = `<div class="error">加载失败: ${error.message}</div>`;
  476. }
  477. }
  478. async function viewTimestamp(timestamp) {
  479. const container = document.getElementById(`videos-${timestamp}`);
  480. if (container.innerHTML) {
  481. container.innerHTML = '';
  482. return;
  483. }
  484. container.innerHTML = '<div class="loading">加载中...</div>';
  485. try {
  486. const response = await fetch(`${API_BASE}/api/videos/${timestamp}`);
  487. const data = await response.json();
  488. let html = '<div class="video-grid">';
  489. for (const video of data.videos) {
  490. html += `
  491. <div class="video-card">
  492. <div class="video-name">🎬 ${video.filename}</div>
  493. <div class="video-info">📊 大小: ${formatBytes(video.file_size)}</div>
  494. <div class="video-info">🕒 创建时间: ${video.created_time}</div>
  495. <div class="video-info">📍 流索引: ${video.stream_index}</div>
  496. <div style="margin-top: 10px; display: flex; gap: 5px;">
  497. <button class="btn btn-play" style="flex: 1;"
  498. onclick="playVideo('${video.full_path}', '${video.filename}', ${video.file_size}, '${video.created_time}', '${video.timestamp_dir}', '${video.stream_index}')">▶ 播放</button>
  499. <button class="btn btn-danger" style="flex: 1;"
  500. onclick="deleteVideo('${video.full_path}')">删除</button>
  501. </div>
  502. </div>
  503. `;
  504. }
  505. html += '</div>';
  506. container.innerHTML = html;
  507. } catch (error) {
  508. container.innerHTML = `<div class="error">加载失败: ${error.message}</div>`;
  509. }
  510. }
  511. async function loadAllVideos() {
  512. const container = document.getElementById('videos-tab');
  513. container.innerHTML = '<div class="loading">加载中...</div>';
  514. try {
  515. const response = await fetch(`${API_BASE}/api/videos`);
  516. const data = await response.json();
  517. if (data.count === 0) {
  518. container.innerHTML = '<div class="loading">暂无视频文件</div>';
  519. return;
  520. }
  521. let html = '<div class="video-grid">';
  522. for (const video of data.videos) {
  523. html += `
  524. <div class="video-card">
  525. <div class="video-name">🎬 ${video.filename}</div>
  526. <div class="video-info">📁 目录: ${video.timestamp_dir}</div>
  527. <div class="video-info">📊 大小: ${formatBytes(video.file_size)}</div>
  528. <div class="video-info">🕒 创建时间: ${video.created_time}</div>
  529. <div class="video-info">📍 流索引: ${video.stream_index}</div>
  530. <div style="margin-top: 10px; display: flex; gap: 5px;">
  531. <button class="btn btn-play" style="flex: 1;"
  532. onclick="playVideo('${video.full_path}', '${video.filename}', ${video.file_size}, '${video.created_time}', '${video.timestamp_dir}', '${video.stream_index}')">▶ 播放</button>
  533. <button class="btn btn-danger" style="flex: 1;"
  534. onclick="deleteVideo('${video.full_path}')">删除</button>
  535. </div>
  536. </div>
  537. `;
  538. }
  539. html += '</div>';
  540. container.innerHTML = html;
  541. } catch (error) {
  542. container.innerHTML = `<div class="error">加载失败: ${error.message}</div>`;
  543. }
  544. }
  545. async function deleteVideo(path) {
  546. if (!confirm(`确定要删除视频文件吗?\n${path}`)) {
  547. return;
  548. }
  549. try {
  550. const response = await fetch(`${API_BASE}/api/video?path=${encodeURIComponent(path)}`, {
  551. method: 'DELETE'
  552. });
  553. const data = await response.json();
  554. if (data.success) {
  555. showMessage('视频删除成功', 'success');
  556. loadData();
  557. } else {
  558. showMessage('视频删除失败: ' + data.message, 'error');
  559. }
  560. } catch (error) {
  561. showMessage('删除失败: ' + error.message, 'error');
  562. }
  563. }
  564. async function deleteTimestamp(timestamp) {
  565. if (!confirm(`确定要删除整个时间戳目录吗?\n${timestamp}\n\n这将删除该目录下的所有文件!`)) {
  566. return;
  567. }
  568. try {
  569. const response = await fetch(`${API_BASE}/api/timestamp/${timestamp}`, {
  570. method: 'DELETE'
  571. });
  572. const data = await response.json();
  573. if (data.success) {
  574. showMessage('目录删除成功', 'success');
  575. loadData();
  576. } else {
  577. showMessage('目录删除失败: ' + data.message, 'error');
  578. }
  579. } catch (error) {
  580. showMessage('删除失败: ' + error.message, 'error');
  581. }
  582. }
  583. async function loadReports() {
  584. const container = document.getElementById('reports-tab');
  585. container.innerHTML = '<div class="loading">加载中...</div>';
  586. try {
  587. const response = await fetch(`${API_BASE}/api/reports`);
  588. const data = await response.json();
  589. if (data.count === 0) {
  590. container.innerHTML = '<div class="loading">暂无轮询报告</div>';
  591. return;
  592. }
  593. let html = '<div class="timestamp-list">';
  594. for (const report of data.reports) {
  595. const summary = report.summary || {};
  596. const successRate = (summary.success_rate * 100 || 0).toFixed(1);
  597. html += `
  598. <div class="timestamp-item">
  599. <div class="timestamp-header">
  600. <div>
  601. <div class="timestamp-name">📊 ${report.timestamp}</div>
  602. <div class="timestamp-info">
  603. 生成时间: ${report.generated_at || 'N/A'}
  604. </div>
  605. <div class="timestamp-info">
  606. 成功率: ${successRate}% |
  607. 成功: ${summary.successful_streams || 0} |
  608. 失败: ${summary.failed_streams || 0} |
  609. 总帧数: ${summary.total_frames || 0}
  610. </div>
  611. </div>
  612. <div>
  613. <button class="btn btn-primary" onclick="viewReport('${report.timestamp}')"查看详情</button>
  614. </div>
  615. </div>
  616. <div id="report-${report.timestamp}"></div>
  617. </div>
  618. `;
  619. }
  620. html += '</div>';
  621. container.innerHTML = html;
  622. } catch (error) {
  623. container.innerHTML = `<div class="error">加载失败: ${error.message}</div>`;
  624. }
  625. }
  626. async function viewReport(timestamp) {
  627. const container = document.getElementById(`report-${timestamp}`);
  628. if (container.innerHTML) {
  629. container.innerHTML = '';
  630. return;
  631. }
  632. container.innerHTML = '<div class="loading">加载中...</div>';
  633. try {
  634. const response = await fetch(`${API_BASE}/api/report/${timestamp}`);
  635. const report = await response.json();
  636. let html = '<div style="margin-top: 15px; padding: 15px; background: white; border-radius: 8px;">';
  637. // 显示流详细信息
  638. if (report.streams && report.streams.length > 0) {
  639. html += '<h3 style="margin-bottom: 15px;">流详细信息</h3>';
  640. html += '<div class="video-grid">';
  641. for (const stream of report.streams) {
  642. const statusEmoji = stream.status === '完成' ? '✅' : '❌';
  643. const statusClass = stream.status === '完成' ? 'success' : 'error';
  644. html += `
  645. <div class="video-card">
  646. <div class="video-name">${statusEmoji} 流 ${stream.stream_index}</div>
  647. <div class="video-info">📹 RTSP: ${stream.rtsp_url}</div>
  648. <div class="video-info">🎬 状态: <span style="color: ${stream.status === '完成' ? 'green' : 'red'}; font-weight: bold;">${stream.status}</span></div>
  649. <div class="video-info">💾 输出: ${stream.output_file || 'N/A'}</div>
  650. <div class="video-info">⏱️ 开始: ${stream.start_time || 'N/A'}</div>
  651. <div class="video-info">⏹️ 结束: ${stream.end_time || 'N/A'}</div>
  652. <div class="video-info">🕒 持续: ${stream.actual_duration_seconds || 0}秒 / ${stream.duration_seconds || 0}秒</div>
  653. <div class="video-info">🎬 帧数: ${stream.frames_received || 0}</div>
  654. <div class="video-info">📊 大小: ${formatBytes(stream.bytes_received || 0)}</div>
  655. ${stream.error_message ? `<div class="video-info" style="color: red;">❌ 错误: ${stream.error_message}</div>` : ''}
  656. </div>
  657. `;
  658. }
  659. html += '</div>';
  660. } else {
  661. html += '<p>暂无流信息</p>';
  662. }
  663. html += '</div>';
  664. container.innerHTML = html;
  665. } catch (error) {
  666. container.innerHTML = `<div class="error">加载失败: ${error.message}</div>`;
  667. }
  668. }
  669. function loadData() {
  670. loadStats();
  671. loadTimestamps();
  672. loadAllVideos();
  673. loadReports();
  674. }
  675. // 页面加载时初始化
  676. window.onload = loadData;
  677. </script>
  678. </body>
  679. </html>