I'm embedding a website using an iframe. The embedded website has an embedded vimeo video that autoplays.
How can I prevent it from autoplaying?
I'm embedding a website using an iframe. The embedded website has an embedded vimeo video that autoplays.
How can I prevent it from autoplaying?
If you have control over the "embedded website", you can use the Vimeo "Player Embedding Parameters" to disable autoplay.
However, if you do not have control over the "embedded website" than you might be able to use javascript to control the autoplay. You would have to set the autoplay
parameter on the Vimeo iframe to 0
(see "Player Embedding Parameters" above).
Roughly speaking, it would look something like:
document.getElementById('website_frame_id').contentWindow.getElementById('vimeo_frame_id').setAttribute('autoplay', 0);
However, contentWindow
isn't supported in all browsers. (See Invoking JavaScript code in an iframe from the parent page for a good discussion)
Also, I'm not sure if this code would be able to update the autoplay
parameter before the Vimeo iframe was loaded. If it wasn't able to, than the video would still autoplay, even once you updated the parameter.