Files
DCCONSTRUCTIONS be58d589e2 feat(fleet): add board observation center with live sources and maps
Add adaptive per-vehicle layouts, full-panel dragging, source controls and automatic preview recovery for RealSense, Insta360 X4 and XGRIDS K1 observation views. Integrate cached Cesium map layers through the private NAS gateway link, retain bounded sensor command receipts, and document validation and operational handoff.
2026-09-10 22:12:05 +03:00

18 lines
704 B
TypeScript

type PreviewVideo = Pick<HTMLVideoElement, 'paused' | 'srcObject' | 'muted' | 'play'>;
/** Restore browser presentation without changing the peer or camera capture. */
export function previewPlayback(video: PreviewVideo | null) {
let disposed = false, pending = false;
return {
resume() {
if (disposed || pending || !video?.srcObject || !video.paused) return;
pending = true;
video.muted = true;
// WebKit can pause an offscreen panel and reject playback while it remains hidden.
// A later visibility/presentation check retries playback on the same stream.
void video.play().catch(() => undefined).finally(() => { pending = false; });
},
dispose() { disposed = true; },
};
}