mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 21:55:26 +03:00
fix overflowing camera image and remove mse console debug
This commit is contained in:
parent
a3267f7d44
commit
efde23ed81
@ -24,6 +24,7 @@ export default function CameraImage({
|
|||||||
|
|
||||||
const { name } = config ? config.cameras[camera] : "";
|
const { name } = config ? config.cameras[camera] : "";
|
||||||
const enabled = config ? config.cameras[camera].enabled : "True";
|
const enabled = config ? config.cameras[camera].enabled : "True";
|
||||||
|
const [isPortraitImage, setIsPortraitImage] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!config || !imgRef.current) {
|
if (!config || !imgRef.current) {
|
||||||
@ -40,11 +41,15 @@ export default function CameraImage({
|
|||||||
{enabled ? (
|
{enabled ? (
|
||||||
<img
|
<img
|
||||||
ref={imgRef}
|
ref={imgRef}
|
||||||
className="object-contain rounded-lg md:rounded-2xl"
|
className={`object-contain ${isPortraitImage ? "h-full w-auto" : "w-full h-auto"} rounded-lg md:rounded-2xl`}
|
||||||
onLoad={() => {
|
onLoad={() => {
|
||||||
setHasLoaded(true);
|
setHasLoaded(true);
|
||||||
|
|
||||||
if (onload) {
|
if (onload) {
|
||||||
|
if (imgRef.current) {
|
||||||
|
const { naturalHeight, naturalWidth } = imgRef.current;
|
||||||
|
setIsPortraitImage(naturalHeight > naturalWidth);
|
||||||
|
}
|
||||||
onload();
|
onload();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -215,8 +215,7 @@ function MSEPlayer({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// eslint-disable-next-line no-console
|
// no-op
|
||||||
console.debug(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -233,8 +232,7 @@ function MSEPlayer({
|
|||||||
try {
|
try {
|
||||||
sb?.appendBuffer(data);
|
sb?.appendBuffer(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// eslint-disable-next-line no-console
|
// no-op
|
||||||
console.debug(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user