доработка README

This commit is contained in:
Maxim
2026-06-17 09:53:29 +03:00
parent bc40c1437a
commit 4180353b65
6 changed files with 936 additions and 76 deletions

View File

@@ -18,8 +18,6 @@ export function initCamera(): void {
camImage = document.getElementById("camImage") as HTMLImageElement;
crosshair = document.getElementById("crosshair");
// Проверяем доступность потока
checkStreamAvailability();
const btn = document.getElementById("camToggle");
@@ -37,6 +35,7 @@ export function initCamera(): void {
// Показываем перекрестие
if (crosshair) {
crosshair.style.display = "block";
crosshair.style.opacity = "0.5";
}
if (camImage) {
@@ -114,29 +113,6 @@ export function initCamera(): void {
btn?.addEventListener("click", toggle);
// Проверка доступности камеры
async function checkStreamAvailability(): Promise<void> {
try {
const response = await fetch('/api/stream');
const data: StreamResponse = await response.json();
if (data.available && data.cam) {
console.log("[camera] stream available:", data.source);
// Автозапуск если камера доступна
if (!isOpen) {
open();
}
} else {
console.log("[camera] stream not available");
if (crosshair) {
crosshair.style.display = 'none';
}
}
} catch (error) {
console.log("[camera] check failed:", error);
}
}
// Мониторинг состояния потока
function startStreamMonitoring(): void {
stopStreamMonitoring();