paulirish / lite-youtube-embed

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

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

Closed zachleat closed 8 months ago

zachleat commented 9 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 9 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 8 months ago

Danke!

Stanzilla commented 8 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 8 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 8 months ago

(also, yay! thanks!)

paulirish commented 8 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.