Set aspect ratio for player correctly

This commit is contained in:
Nick Mowen 2023-12-30 11:51:02 -07:00
parent 6807400314
commit 5e2225b8ac

View File

@ -214,10 +214,11 @@ function PreviewContent({
} else { } else {
return ( return (
<> <>
<div className={`${getPreviewWidth(camera, config)}`}> <div className="w-full">
<VideoPlayer <VideoPlayer
options={{ options={{
preload: "auto", preload: "auto",
aspectRatio: "16:9",
autoplay: true, autoplay: true,
controls: false, controls: false,
muted: true, muted: true,
@ -263,12 +264,12 @@ function isCurrentHour(timestamp: number) {
function getPreviewWidth(camera: string, config: FrigateConfig) { function getPreviewWidth(camera: string, config: FrigateConfig) {
const detect = config.cameras[camera].detect; const detect = config.cameras[camera].detect;
if (detect.width / detect.height < 1.0) { if (detect.width / detect.height < 1) {
return "w-[120px]"; return "w-1/2";
} }
if (detect.width / detect.height < 1.4) { if (detect.width / detect.height < 16 / 9) {
return "w-[208px]"; return "w-2/3";
} }
return "w-full"; return "w-full";