From f8fd626673e6e2e2ef158f2c92af19999e06d47b Mon Sep 17 00:00:00 2001 From: Jeremy Karlsson Date: Fri, 3 Feb 2023 15:20:12 +0100 Subject: [PATCH] Make sure videos are 16:9 --- src/Element/TidalEmbed.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Element/TidalEmbed.tsx b/src/Element/TidalEmbed.tsx index b1e7685..b97ddf2 100644 --- a/src/Element/TidalEmbed.tsx +++ b/src/Element/TidalEmbed.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { CSSProperties, useEffect, useState } from "react"; import { TidalRegex } from "Const"; // Re-use dom parser across instances of TidalEmbed @@ -34,6 +34,7 @@ async function oembedLookup (link: string) { const TidalEmbed = ({ link }: { link: string }) => { const [source, setSource] = useState(); const [height, setHeight] = useState(); + const extraStyles = link.includes('video') ? { aspectRatio: "16 / 9" } : { height }; useEffect(() => { oembedLookup(link).then(data => { @@ -43,7 +44,7 @@ const TidalEmbed = ({ link }: { link: string }) => { }, [link]); if (!source) return e.stopPropagation()} className="ext">{link}; - return