fix(cctv): label a refused viewer's frame fallback instead of the live row

/frame now keeps a pullable HLS camera's shared health, so a viewer
refused for capacity saw its placeholder or Street View frame under the
live row's LIVE · OK badge and "Live HLS connected". When a video camera
is shown on its frame fallback while the row says live, the panel badge
now reads FALLBACK · DEGRADED and the meta line drops the live message;
the shared row stays as it is for the other viewers.
This commit is contained in:
German Khokhlov committed 2026-11-20 12:29:50 +04:00
1 parent 0bebd59b69
commit 58d2c23860
5 files changed
+113 -7

No files matched your search

+13
View File
@@ -186,6 +186,14 @@ export function _settleCctvFrame(token, src, ok) {
);
}
/** Shared live health describes the stream even when this viewer shows a frame. */
export function isCctvLiveFrameFallback(activeCamera) {
return (
activeCamera?.isVideo === false &&
String(activeCamera.sourceKind || '').toLowerCase() === 'live'
);
}
/** The source badge's label and frame state for the camera and preview. */
export function presentCctvSourceBadge(activeCamera, enabled, frame) {
if (!enabled || !activeCamera)
@@ -194,6 +202,11 @@ export function presentCctvSourceBadge(activeCamera, enabled, frame) {
return { label: t('FRAME · LOADING'), state: 'loading' };
if (frame.error && !frame.hasFrame)
return { label: t('FRAME · UNAVAILABLE'), state: 'error' };
if (isCctvLiveFrameFallback(activeCamera))
return {
label: `${cctvSourceKindLabel('fallback')} · ${cctvSourceStatusLabel('degraded')}`,
state: 'ready',
};
const kind = cctvSourceKindLabel(
activeCamera.sourceKind || activeCamera.feedType || 'unknown',
);