MOREE!!!!

This commit is contained in:
legop3
2026-06-19 01:22:42 -04:00
parent ea8e027be9
commit c7f5cb68f4
22 changed files with 429 additions and 138 deletions
+18
View File
@@ -2,6 +2,7 @@
// Purpose: Coordinates client-side video stream request intents and authorization timing. Scope: Provides reusable request helpers for rover and room video consumers.
import { useEffect, useMemo, useRef, useState } from 'react';
import { useSocket } from '../context/SocketContext.jsx';
import { trackAnalyticsEventThrottled } from '../analytics/index.js';
function normalizeEntry(entry) {
if (!entry) return null;
@@ -90,6 +91,23 @@ export function useVideoRequests(sourceList = [], options = {}) {
const payload = entry.type === 'room' ? { roomCameraId: entry.id } : { roverId: entry.id };
socket.emit('video:request', payload, (resp = {}) => {
if (cancelled) return;
if (resp?.error) {
/*
Video authorization/session failures are operational signals, but
this hook can request several feeds at once and retry after socket
reconnects. Throttle by feed key so one broken camera does not flood
Umami while still showing which rover or room camera is affected.
*/
trackAnalyticsEventThrottled(
'video_request_failed',
{
type: entry.type,
sourceId: entry.id,
reason: resp.error,
},
{ key: `${entry.type}:${entry.id}:${resp.error}`, throttleMs: 60 * 1000 },
);
}
setSources((prev) => ({ ...prev, [entry.key]: resp }));
});
}