mchlkucera / notion-to-html

API for converting Notion database items to simple HTML
36 stars 19 forks source link

FR: Optimize youtube embeds #7

Open alez156 opened 1 year ago

alez156 commented 1 year ago

I noticed youtube embeds take a while to load. Sometimes up to 10 or more seconds. Leaving big gaps of blank space in the articles.

Here's an example page. (This took like 12 seconds to load)

I did some research and apparently this is a problem with youtube embeds in general. And this page fixes the embeds by adding a preview image with a play button and load the youtube video on click.

Would it be possible to implement something like this? I like that you can disable suggested videos, show player controls and allow full screen.

The only downside is that the user has to click twice to watch the video. But I think it's better than having to showing blank gaps and have the page load for 10+ seconds 🤔

mchlkucera commented 1 year ago

Thanks for the issue. For now I added loading="lazy". I need to look into this further to optimize the loading. Im planning to use this library https://lite-embed.vercel.app/docs/react/quick-start