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

View File

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