delucis / astro-embed

Low-JavaScript embed components for Astro websites
https://astro-embed.netlify.app
MIT License
166 stars 24 forks source link

Issue: Autoplay not working in param #91

Closed sikiryl closed 3 months ago

sikiryl commented 3 months ago

I try to use the autoplay=1 params but it doesn't work appropriately.

<YouTube class=" mx-auto max-w-full" params="autoplay=1 id="https://www.youtube.com/watch?v=abc" />
delucis commented 3 months ago

I think this is expected behaviour. This YouTube component is intentionally designed to avoid loading the YouTube iframe until a user interacts with it. This avoids downloading and running lots of code potentially slowing down a page if a user doesn’t need it.

For autoplaying videos, I’d recommend using the YouTube <iframe> directly.