mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-03 13:54:55 +03:00
Snapshot: move spam-click guard to controls layer
This commit is contained in:
parent
9e563823ac
commit
bef2ecdc23
@ -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 (
|
||||
|
||||
@ -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>) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user