disable embedded video autoplay

I’ve done a ton of Google searching regarding html & videos, and can not figure out how to get this mp4 video to not autoplay when the page loads. I thought the autoplay=“false” should do it, but it doesn’t.

What am I missing?

The cell’s code is:

video = html`
<iframe width="560" height="315" src="https://soe-wbe-pilot.wl.r.appspot.com/static/scan_wbe_overview.mp4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay="false"; clipboard-write; encrypted-media; gyroscope; controls=true; picture-in-picture" allowfullscreen></iframe>`

thank you!

3 Likes

This seems to work for me… tested on Chrome and Safari…

1 Like

I’m seeing the autoplay issue too. I thought removing autoplay from the allow= “” would work, but it didn’t help.

This seems to work though:

Hope this helps! and thanks for writing!

1 Like

Hi Zan! Since you’ve got a link to the mp4 video directly (and it’s not e.g. a YouTube embed), I recommend using the simpler video element instead of an iframe. Something like this should do it:

video = htl.html`
<video width="560" height="315" controls>
<source src="https://soe-wbe-pilot.wl.r.appspot.com/static/scan_wbe_overview.mp4">
</video>`

Video elements do not autoplay by default, so you shouldn’t have an autoplay issue.

(Edit: Ah, @Ananya made the same suggestion!)

Thank you Ananya & Mike!!!