mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 22:25:24 +03:00
Maintain slow loading behavior
This commit is contained in:
parent
04d1ec1f92
commit
3838a61059
@ -487,6 +487,14 @@ function PreviewFramesPlayer({
|
||||
|
||||
// initial state
|
||||
|
||||
const [firstLoad, setFirstLoad] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (previewFrames != undefined && previewFrames.length == 0) {
|
||||
setFirstLoad(false);
|
||||
}
|
||||
}, [previewFrames]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!controller) {
|
||||
return;
|
||||
@ -501,6 +509,8 @@ function PreviewFramesPlayer({
|
||||
}, [controller]);
|
||||
|
||||
const onImageLoaded = useCallback(() => {
|
||||
setFirstLoad(false);
|
||||
|
||||
if (!controller) {
|
||||
return;
|
||||
}
|
||||
@ -536,14 +546,12 @@ function PreviewFramesPlayer({
|
||||
className={`size-full rounded-lg bg-black object-contain md:rounded-2xl`}
|
||||
onLoad={onImageLoaded}
|
||||
/>
|
||||
{previewFrames && previewFrames.length === 0 && (
|
||||
{previewFrames?.length === 0 && (
|
||||
<div className="-y-translate-1/2 align-center absolute inset-x-0 top-1/2 rounded-lg bg-background_alt text-center text-primary md:rounded-2xl">
|
||||
No Preview Found for {camera.replaceAll("_", " ")}
|
||||
</div>
|
||||
)}
|
||||
{previewFrames == undefined && (
|
||||
<Skeleton className="absolute aspect-video size-full" />
|
||||
)}
|
||||
{firstLoad && <Skeleton className="absolute aspect-video size-full" />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user