react-notion-x icon indicating copy to clipboard operation
react-notion-x copied to clipboard

feat: support hd youtube placeholders

Open joaocdvr opened this issue 3 years ago • 2 comments
trafficstars

youtube-placeholder

Description

The youtube video placeholder/thumbnail is too low resolution for it to look good on larger screens, at least for my use case.

My proposal is to add an hasOnlyHDVideos prop to the NotionRenderer component that changes the LiteYoutubeEmbed placeholder image URL coming from YouTube's API (img.youtube.com) resolution from hqdefault to maxresdefault.

Additionally, I added the window width value to the NotionContext via the useWindowSize hook from react-use to be able to switch between hqdefault and maxresdefault depending on the window screen width if hasOnlyHDVideos === true.

The reason why I didn't simply switch the current resolution from hqdefault to maxresdefault is because, if the embedded video is not HD, the placeholder doesn't exist. For example:

Notion Test Page ID

7cac0f415bd4438a95fda8871f02e9ad

joaocdvr avatar Jul 07 '22 14:07 joaocdvr

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
react-notion-x ❌ Failed (Inspect) Jul 7, 2022 at 2:37PM (UTC)
react-notion-x-minimal-demo ✅ Ready (Inspect) Visit Preview Jul 7, 2022 at 2:37PM (UTC)

vercel[bot] avatar Jul 07 '22 14:07 vercel[bot]

Hey @transitive-bullshit, do you mind telling me why did the react-notion-x deployment fail? Thx in advance :)

joaocdvr avatar Jul 13 '22 11:07 joaocdvr