Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix youtube embed starting at specific timestamp #320

Conversation

martin-lacko-rebood
Copy link
Contributor

@martin-lacko-rebood martin-lacko-rebood commented Jul 3, 2022

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

@vercel
Copy link

vercel bot commented Jul 3, 2022

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

Name Status Preview Updated (UTC)
react-notion-x ✅ Ready (Inspect) Visit Preview Nov 1, 2024 4:36am
react-notion-x-minimal-demo ✅ Ready (Inspect) Visit Preview Nov 1, 2024 4:36am

@transitive-bullshit transitive-bullshit merged commit 2745c39 into NotionX:master Nov 1, 2024
0 of 4 checks passed
@transitive-bullshit
Copy link
Member

Thanks @martin-lacko-rebood 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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