justinmahar / react-social-media-embed

📰 Easily embed social media posts from Facebook, Instagram, LinkedIn, Pinterest, TikTok, X (Twitter), and YouTube in React.
https://justinmahar.github.io/react-social-media-embed/
MIT License
215 stars 30 forks source link

YouTube Shorts support #59

Closed jj0e closed 9 months ago

jj0e commented 10 months ago

Are embeds for YouTube shorts currently supported? I tried to use the existing YouTubeEmbed component which a YouTube shorts url and it does not load the video.

justinmahar commented 9 months ago

Hey @jj0e! I'm using react-youtube under the hood for YT embeds, not sure if that library supports shorts yet. Will look into adding support for this when I have a chance. Might need to build out a separate embed component if they're a different beast.

justinmahar commented 9 months ago

@jj0e I've added support for YouTube Shorts. Just use the link to any YouTube Shorts video and it'll embed now.

You can see the demo here.

Shorts are 9:16, so be sure to specify a width and height in that aspect ratio, such as 225x400.

npm i react-social-media-embed@latest

Grab the latest version and give it a shot.