paulirish / lite-youtube-embed

A faster youtube embed.
https://paulirish.github.io/lite-youtube-embed/
Other
5.6k stars 259 forks source link

Add a `js-api` attribute to opt-in to the YouTube Iframe Player API #164

Closed zachleat closed 4 months ago

zachleat commented 4 months ago

Allows using the getPlayer asynchronous method to access the player instance to control the video.

https://developers.google.com/youtube/iframe_api_reference#seekTo

Added an additional test/demo that shows usage examples.

Inspired by work on this stream: https://www.youtube.com/watch?v=MrVMewBq0jE

vercel[bot] commented 4 months ago

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

Name Status Preview Comments Updated (UTC)
lite-youtube-embed ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 23, 2024 4:00pm
paulirish commented 4 months ago

Danke!

Stanzilla commented 4 months ago

Demo errors with

Uncaught (in promise) TypeError: video.getPlayer is not a function
    at seekTo (js-api.html:17:27)
    at HTMLButtonElement.onclick (js-api.html:25:59)
zachleat commented 4 months ago

@Stanzilla looks like it was post-merge refactored as getYTPlayer.

@paulirish don’t forget to change README.md and variants/js-api.html too!

zachleat commented 4 months ago

(also, yay! thanks!)

paulirish commented 4 months ago

@Stanzilla looks like it was post-merge refactored as getYTPlayer. @paulirish don’t forget to change README.md and variants/js-api.html too!

Yup yup. Thanks! missed these. 😊

Edit: all fixed and shipped a 0.3.2 just to make sure readme docs are good on npm.