autoplay=1, muted=1, and api=1 parameters. play() on modal open and pause() on modal close, tied to your custom button events.You want to autoplay a Vimeo video when a modal opens, stop it when closed, and control this via buttons other than the native Vimeo controls. Webflow's native video element doesn't support full Vimeo API communication, so you must use an Embed element with Vimeo's player API and custom code.
autoplay=1: triggers autoplay.muted=1: required by many browsers to autoplay.api=1: enables JavaScript control via Vimeo Player API.id: assign a unique ID to the iframe, like "vimeo-video".
Example embed code:
<iframe id="vimeo-video" src="https://player.vimeo.com/video/123456789?autoplay=1&muted=1&api=1" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
<script src="https://player.vimeo.com/api/player.js"></script>
Example script (place before closing </body> tag):
<script>
var iframe = document.getElementById('vimeo-video');
var player = new Vimeo.Player(iframe);
// Play video when modal opens
document.getElementById('open-button').addEventListener('click', function() {
player.play();
});
// Pause video when modal closes
document.getElementById('close-button').addEventListener('click', function() {
player.pause();
});
</script>
'open-button' and 'close-button' with the actual IDs of your modal open and close triggers.
player.play() method.player.pause().
To autoplay and stop a Vimeo video via non-native buttons in Webflow:
autoplay=1, muted=1, and api=1 parameters.<script> tag.