Skip to content

Commit 1c36fc0

Browse files
bibakroybibakroy
bibakroy
authored andcommitted
fix youtube video overflow issue
1 parent 7c94bf5 commit 1c36fc0

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/Content/Embed/EmbedVideo.tsx

+18-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ function ThumbnailWrapper({
3737
onClick={() => setHideThumbnail(true)}
3838
onError={() => setError(true)}
3939
style={{
40-
width: adjustedWidth,
41-
height: adjustedHeight,
42-
backgroundImage: `url(${error ? discordImageFailure : thumbnail})`,
40+
width: "100%",
41+
height: "auto",
42+
maxWidth: adjustedWidth,
43+
maxHeight: adjustedHeight,
4344
}}
4445
>
46+
<Styles.Image src={error ? discordImageFailure : thumbnail} />
4547
<Styles.VideoThumbnailPlayButtonContainer>
4648
<Styles.VideoThumbnailPlayButton
4749
width={12}
@@ -61,6 +63,13 @@ interface EmbedVideoProps
6163
}
6264

6365
function EmbedVideo(props: EmbedVideoProps) {
66+
const { width: adjustedWidth, height: adjustedHeight } = useSize(
67+
props.width,
68+
props.height
69+
);
70+
71+
console.log({ props, adjustedWidth, adjustedHeight });
72+
6473
if (props.proxyUrl)
6574
return (
6675
<ThumbnailWrapper
@@ -94,8 +103,12 @@ function EmbedVideo(props: EmbedVideoProps) {
94103
height={props.height}
95104
>
96105
<Styles.VideoIframe
97-
width={400}
98-
height={225}
106+
width="100%"
107+
height="100%"
108+
style={{
109+
maxWidth: adjustedWidth,
110+
maxHeight: adjustedHeight,
111+
}}
99112
src={url.toString()}
100113
allowFullScreen={true}
101114
/>

0 commit comments

Comments
 (0)