From b75a3185daaa81c3e64b66d5409f288e30ac691c Mon Sep 17 00:00:00 2001 From: James Date: Sat, 14 Feb 2026 02:27:15 -0500 Subject: [PATCH] Revert to MJPEG stream for camera - works perfectly in browser --- index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index ec1f6e4..030f4fe 100644 --- a/index.html +++ b/index.html @@ -348,21 +348,20 @@ function isCamTime() { return h >= 19 || h < 8; } -// Double-buffer: load in hidden img, swap on load (no flicker) -const bufImg = new Image(); -bufImg.onload = () => { camImg.src = bufImg.src; }; - -function refreshCam() { +function updateCam() { if (isCamTime()) { camWrap.style.display = ''; - bufImg.src = '/api/cam/pulse-ox?' + Date.now(); + if (!camImg.src.includes('/stream')) { + camImg.src = '/api/cam/pulse-ox/stream'; + } } else { camWrap.style.display = 'none'; + camImg.src = ''; } } -refreshCam(); -setInterval(refreshCam, 1000); +updateCam(); +setInterval(updateCam, 60000);