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]);
|
}, [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 (
|
||||||
|
|||||||
@ -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>) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user