Snapshot: move spam-click guard to controls layer

This commit is contained in:
nrlcode 2026-03-27 14:41:53 -07:00
parent 9e563823ac
commit bef2ecdc23
2 changed files with 4 additions and 14 deletions

View File

@ -278,10 +278,6 @@ export default function HlsVideoPlayer({
}, [videoRef, inpointOffset]); }, [videoRef, inpointOffset]);
const handleSnapshot = useCallback(async () => { const handleSnapshot = useCallback(async () => {
if (isSnapshotLoading) {
return;
}
setIsSnapshotLoading(true); setIsSnapshotLoading(true);
try { try {
const frameTime = getVideoTime(); const frameTime = getVideoTime();
@ -307,15 +303,7 @@ export default function HlsVideoPlayer({
} finally { } finally {
setIsSnapshotLoading(false); setIsSnapshotLoading(false);
} }
}, [ }, [camera, config?.ui?.timezone, currentTime, getVideoTime, t, videoRef]);
camera,
config?.ui?.timezone,
currentTime,
getVideoTime,
isSnapshotLoading,
t,
videoRef,
]);
const onSnapshot = camera ? handleSnapshot : undefined; const onSnapshot = camera ? handleSnapshot : undefined;
return ( return (

View File

@ -307,7 +307,9 @@ export default function VideoControls({
aria-disabled={snapshotLoading} aria-disabled={snapshotLoading}
className={cn( className={cn(
"size-5", "size-5",
snapshotLoading ? "cursor-not-allowed opacity-50" : "cursor-pointer", snapshotLoading
? "cursor-not-allowed opacity-50"
: "cursor-pointer",
)} )}
title={snapshotTitle} title={snapshotTitle}
onClick={(e: React.MouseEvent<SVGElement>) => { onClick={(e: React.MouseEvent<SVGElement>) => {