mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
feat: GIF and Video embed support
This commit is contained in:
parent
e74c3a5f80
commit
744afe2f6a
1 changed files with 26 additions and 0 deletions
|
@ -89,6 +89,20 @@ export default function Embed({ embed }: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, height } = calculateSize(mw, mh);
|
const { width, height } = calculateSize(mw, mh);
|
||||||
|
if (embed.type === "Website" && embed.special?.type === "GIF") {
|
||||||
|
return (
|
||||||
|
<EmbedMedia
|
||||||
|
embed={embed}
|
||||||
|
width={
|
||||||
|
height *
|
||||||
|
((embed.image?.width ?? 0) /
|
||||||
|
(embed.image?.height ?? 0))
|
||||||
|
}
|
||||||
|
height={height}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.embed, styles.website)}
|
className={classNames(styles.embed, styles.website)}
|
||||||
|
@ -181,6 +195,18 @@ export default function Embed({ embed }: Props) {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
case "Video": {
|
||||||
|
return (
|
||||||
|
<video
|
||||||
|
className={classNames(styles.embed, styles.image)}
|
||||||
|
style={calculateSize(embed.width, embed.height)}
|
||||||
|
src={client.proxyFile(embed.url)}
|
||||||
|
frameBorder="0"
|
||||||
|
loading="lazy"
|
||||||
|
controls
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue