From 140e8186fd8bba9d24d7a5ae338d01468e3ef566 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 22 Nov 2026 08:23:05 -0500 Subject: [PATCH 1/3] Apply suggested fix to web/js/components/preact/HLSVideoCell.tsx from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- web/js/components/preact/HLSVideoCell.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/js/components/preact/HLSVideoCell.tsx b/web/js/components/preact/HLSVideoCell.tsx index ed38ee004..59208a845 100644 --- a/web/js/components/preact/HLSVideoCell.tsx +++ b/web/js/components/preact/HLSVideoCell.tsx @@ -403,8 +403,8 @@ export function HLSVideoCell({ console.log(`Using HLS.js for stream ${stream.name} (mode: ${usingGo2rtc ? 'go2rtc' : 'native'})`); // Shared low-memory budget: keep only a small forward buffer and zero back-buffer. - // backBufferLength: 0 is the single biggest win — HLS.js default keeps decoded - // frames forever for seeking, which multiplies by stream count and crashes the tab. + // backBufferLength: 0 removes played media from the buffer as playback advances, + // which helps reduce memory pressure across many concurrent streams. const sharedMemoryConfig = { maxBufferLength: 4, // seconds of forward buffer (default: 30) maxMaxBufferLength: 8, // hard ceiling (default: 600) From 3cf05d520ef5b3b4da4caa5a555645f30545e222 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 22 Nov 2026 08:23:06 -0500 Subject: [PATCH 2/3] Apply suggested fix to web/js/components/preact/HLSVideoCell.tsx from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- web/js/components/preact/HLSVideoCell.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/js/components/preact/HLSVideoCell.tsx b/web/js/components/preact/HLSVideoCell.tsx index 59208a845..ef6b2f7b0 100644 --- a/web/js/components/preact/HLSVideoCell.tsx +++ b/web/js/components/preact/HLSVideoCell.tsx @@ -95,8 +95,17 @@ export function HLSVideoCell({ useEffect(() => { if (privacyActive) { + const focused = document.activeElement; + const container = tileContainerRef.current; + const focusedInTile = focused instanceof Node && !!container?.contains(focused); + + if (!focusedInTile) { + hadPrivacyFocusRef.current = false; + previousFocusedElementRef.current = null; + return; + } + if (!hadPrivacyFocusRef.current) { - const focused = document.activeElement; previousFocusedElementRef.current = focused instanceof HTMLElement && focused !== document.body ? focused : null; } @@ -106,6 +115,12 @@ export function HLSVideoCell({ } if (!hadPrivacyFocusRef.current) return; + if (document.activeElement !== privacyResumeButtonRef.current) { + hadPrivacyFocusRef.current = false; + previousFocusedElementRef.current = null; + return; + } + hadPrivacyFocusRef.current = false; const previous = previousFocusedElementRef.current; if (previous && previous.isConnected) { From 117f15a736ddee5eb5dfcddb4e94596de161af0e Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 22 Nov 2026 08:24:43 -0500 Subject: [PATCH 3/3] Preserve initial privacy focus and focus restoration --- web/js/components/preact/HLSVideoCell.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/js/components/preact/HLSVideoCell.tsx b/web/js/components/preact/HLSVideoCell.tsx index ef6b2f7b0..27104ffdf 100644 --- a/web/js/components/preact/HLSVideoCell.tsx +++ b/web/js/components/preact/HLSVideoCell.tsx @@ -99,7 +99,7 @@ export function HLSVideoCell({ const container = tileContainerRef.current; const focusedInTile = focused instanceof Node && !!container?.contains(focused); - if (!focusedInTile) { + if (!focusedInTile && focused !== document.body) { hadPrivacyFocusRef.current = false; previousFocusedElementRef.current = null; return; @@ -115,7 +115,8 @@ export function HLSVideoCell({ } if (!hadPrivacyFocusRef.current) return; - if (document.activeElement !== privacyResumeButtonRef.current) { + if (document.activeElement !== privacyResumeButtonRef.current && + document.activeElement !== document.body) { hadPrivacyFocusRef.current = false; previousFocusedElementRef.current = null; return;