Standbild

This commit is contained in:
chk
2026-06-07 10:42:28 +02:00
parent faccbf55ce
commit d3e45262ce
6 changed files with 155 additions and 19 deletions

View File

@@ -54,8 +54,9 @@ function createSnapshotRouter(switches, cameras) {
const sw = switches[req.params.id];
if (!sw) return res.status(404).json({ error: `Unbekannte Kamera: ${req.params.id}` });
try {
// getFrame() startet die Kamera bei Bedarf on-demand und wartet auf ein frisches Bild
const frame = await sw.getFrame();
// grabSnapshot(): liefert das Live-Frame falls vorhanden, sonst (Snapshot-Modus,
// stream:false) ein one-shot Bild öffnet das Gerät kurz und schliesst es wieder.
const frame = await sw.grabSnapshot();
res.set({
'Content-Type': 'image/jpeg',
'Content-Length': frame.length,