Improve image loading by not loading when off screen

This commit is contained in:
Nicolas Mowen 2024-09-11 19:10:55 -06:00
parent f3784505e0
commit 1b6d11a2b0
3 changed files with 6 additions and 0 deletions

View File

@ -93,6 +93,7 @@ export default function CameraImage({
"rounded-lg md:rounded-2xl",
)}
onLoad={handleImageLoad}
loading="lazy"
/>
) : (
<div className="pt-6 text-center">

View File

@ -539,6 +539,7 @@ function PreviewFramesPlayer({
<img
ref={imgRef}
className={`size-full rounded-lg bg-black object-contain md:rounded-2xl`}
loading="lazy"
onLoad={onImageLoaded}
/>
{previewFrames?.length === 0 && (

View File

@ -29,7 +29,11 @@ function Live() {
if (group) {
setCameraGroup(cameraGroup);
}
return true;
}
return false;
});
// fullscreen