Hi. I have this code to make the popup videos autoplay with their corresponding buttons. It’s working in chrome, mozilla, microsoft edge, but not in safari. How can i make it work on safari?
<script>
document.addEventListener("DOMContentLoaded", function () {
const videos = [
{ iframeId: 'home-hero-video', buttonId: 'popup-toggle' },
{ iframeId: 'mobile-demo', buttonId: 'mobile-play-btn' },
{ iframeId: 'web-demo', buttonId: 'web-play-btn' },
];
videos.forEach(({ iframeId, buttonId }) => {
const iframe = document.getElementById(iframeId);
const playButton = document.getElementById(buttonId);
const player = new Vimeo.Player(iframe);
playButton.addEventListener('click', function () {
setTimeout(() => {
player.play();
}, 3500);
});
});
});
</script>
Here is my website link to check it out: https://celerity-studios-3f05b0.webflow.io/
You can find the videos here: