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

Fix youtube embed starting at specific timestamp

Open martin-lacko-rebood opened this issue 3 years ago • 1 comments
trafficstars

Youtube embedded video with specific timestamps doesn't open on said timestamp when played

I've noticed that embedding a video to notion page with a specific timestamp is properly supported by notion itself, but when said page is rendered using react-notion-x renderer, the video simply starts from the beginning.

I believe this is not expected behaviour so I had a look. It appears the component used to render the youtube video (LiteYouTubeEmbed) itself does support params, however those params were actually never passed to said component. I added simple parse function for the URL search params that returns them as a Record<string, string> and pass those params down to the component which solves the issue. I'm calling the function itself getUrlParams not getYoutubeUrlParams because it has no relation to youtube URLs themselves, it simply returns params from whatever url is provided thus can be used elsewhere as well.

Notion Test Page ID -> 769e7a8e652a42518a9780e804ae97cf

Fixes #321

martin-lacko-rebood avatar Jul 03 '22 17:07 martin-lacko-rebood

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

Name Status Preview Updated
react-notion-x ✅ Ready (Inspect) Visit Preview Jul 3, 2022 at 5:57PM (UTC)
react-notion-x-minimal-demo ✅ Ready (Inspect) Visit Preview Jul 3, 2022 at 5:57PM (UTC)

vercel[bot] avatar Jul 03 '22 17:07 vercel[bot]