Webcam: Buttons fuer Kamera-Aufloesung (VGA/SVGA)

Schaltet die ESP32-CAM-Aufloesung per Button um (VGA 640x480 = mehr FPS,
SVGA 800x600 = mehr Detail). Server proxyt den /control-Aufruf an die
Kamera (Host automatisch aus CAMERA_URL, Port 80).

- /api/cam_framesize (Whitelist 10=VGA, 11=SVGA)
- zwei Buttons + Status-Feedback im Frontend

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 17:09:46 +02:00
parent b50a2d3316
commit 07c0e44cd8
2 changed files with 57 additions and 0 deletions

View File

@@ -153,6 +153,8 @@
<button id="setLineBtn">Zähllinie setzen</button>
<button id="resetCountBtn" class="danger">Zähler zurücksetzen</button>
<button id="grabberBtn">Kamera freigeben</button>
<button id="resVgaBtn" title="640×480 mehr FPS">VGA</button>
<button id="resSvgaBtn" title="800×600 mehr Detail">SVGA</button>
</div>
<div class="info" id="infoText">Klicke auf "Zähllinie setzen" und dann zweimal auf das Video, um die Zähllinie zu definieren.</div>
<a href="/">Back to Home</a>
@@ -334,6 +336,28 @@
}
}
async function setFramesize(val, label) {
infoText.textContent = `Setze Auflösung auf ${label}`;
try {
const r = await fetch('/api/cam_framesize', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ val })
});
const d = await r.json();
infoText.textContent = d.ok
? `Auflösung auf ${label} gesetzt`
: `Fehler: ${d.error || 'Kamera nicht erreichbar'}`;
} catch (e) {
infoText.textContent = 'Fehler beim Setzen der Auflösung';
}
setTimeout(() => {
infoText.textContent = 'Klicke auf "Zähllinie setzen" und dann zweimal auf das Video, um die Zähllinie zu definieren.';
}, 2500);
}
document.getElementById('resVgaBtn').addEventListener('click', () => setFramesize(10, 'VGA 640×480'));
document.getElementById('resSvgaBtn').addEventListener('click', () => setFramesize(11, 'SVGA 800×600'));
grabberBtn.addEventListener('click', async () => {
grabberBtn.disabled = true;
try {