I have 3 videos that I embed with <iframe>, they all have autoplay=1, since I wanted them to start as soon as the slide with that video is shown.
However instead all of them start playing at the same time (even before I see the slide with the first video).
You can remove the autoplay query from the YouTube URL and instead add a data-autoplay attribute on the iframe, like this:
<iframe src="https://www.youtube.com/embed/sGF6bOi1NfA" data-autoplay></iframe>
Alternatively, you can lazy-load the iframe when the containing slide is shown by swapping "src" for "data-src":
<iframe data-src="https://www.youtube.com/embed/sGF6bOi1NfA?autoplay=1"></iframe>
Thank you, I confirm this works!
Most helpful comment
You can remove the autoplay query from the YouTube URL and instead add a
data-autoplayattribute on the iframe, like this:Alternatively, you can lazy-load the iframe when the containing slide is shown by swapping "src" for "data-src":