diff --git a/src/components/Post/Embed/ExternalEmbed/Gif.tsx b/src/components/Post/Embed/ExternalEmbed/Gif.tsx index 8e84997314..1e5e8975e3 100644 --- a/src/components/Post/Embed/ExternalEmbed/Gif.tsx +++ b/src/components/Post/Embed/ExternalEmbed/Gif.tsx @@ -11,6 +11,7 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {HITSLOP_20} from '#/lib/constants' +import {clamp} from '#/lib/numbers' import {type EmbedPlayerParams} from '#/lib/strings/embed-player' import {isWeb} from '#/platform/detection' import {useAutoplayDisabled} from '#/state/preferences' @@ -111,6 +112,15 @@ export function GifEmbed({ playerRef.current?.toggleAsync() }, []) + let aspectRatio = 1 + if (params.dimensions) { + aspectRatio = clamp( + params.dimensions.width / params.dimensions.height, + 0.75, + 4, + ) + } + return (