diff --git a/web/src/components/card/AnimatedEventCard.tsx b/web/src/components/card/AnimatedEventCard.tsx index 0531f3d87..552aa9f26 100644 --- a/web/src/components/card/AnimatedEventCard.tsx +++ b/web/src/components/card/AnimatedEventCard.tsx @@ -14,6 +14,7 @@ import { baseUrl } from "@/api/baseUrl"; import { useApiHost } from "@/api"; import { isSafari } from "react-device-detect"; import { usePersistence } from "@/hooks/use-persistence"; +import { Skeleton } from "../ui/skeleton"; type AnimatedEventCardProps = { event: ReviewSegment; @@ -57,6 +58,8 @@ export function AnimatedEventCard({ }; }, [visibilityListener]); + const [isLoaded, setIsLoaded] = useState(false); + // interaction const navigate = useNavigate(); @@ -109,6 +112,7 @@ export function AnimatedEventCard({ className="size-full select-none" src={`${apiHost}${event.thumb_path.replace("/media/frigate/", "")}`} loading={isSafari ? "eager" : "lazy"} + onLoad={() => setIsLoaded(true)} /> ) : ( <> @@ -122,6 +126,11 @@ export function AnimatedEventCard({ setReviewed={() => {}} setIgnoreClick={() => {}} isPlayingBack={() => {}} + onTimeUpdate={() => { + if (!isLoaded) { + setIsLoaded(true); + } + }} windowVisible={windowVisible} /> ) : ( @@ -132,6 +141,11 @@ export function AnimatedEventCard({ muted disableRemotePlayback loop + onTimeUpdate={() => { + if (!isLoaded) { + setIsLoaded(true); + } + }} > )} -
-
- + {isLoaded && ( +
+
+ +
-
+ )} + {!isLoaded && }