Merge pull request #203 from goaaats/fix/youtube_timestamp

Append youtube timestamp to embed url if provided by january
This commit is contained in:
Paul Makles 2021-09-09 22:53:36 +01:00 committed by GitHub
commit 633933fb48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,15 +18,22 @@ export default function EmbedMedia({ embed, width, height }: Props) {
const client = useClient();
switch (embed.special?.type) {
case "YouTube":
case "YouTube": {
let timestamp = "";
if (embed.special.timestamp) {
timestamp = `&start=${embed.special.timestamp}`;
}
return (
<iframe
loading="lazy"
src={`https://www.youtube-nocookie.com/embed/${embed.special.id}?modestbranding=1`}
src={`https://www.youtube-nocookie.com/embed/${embed.special.id}?modestbranding=1${timestamp}`}
allowFullScreen
style={{ height }}
/>
);
}
case "Twitch":
return (
<iframe