Safari (and especially in low power mode) restricts autoplay for background videos, particularly when they have sound or are not muted. This is a known browser-level limitation and not just a Webflow issue.
Here’s how to handle it using Webflow’s tools and some custom code.
Add this custom JavaScript to your site using an Embed element or in the Before
section of the Project Settings custom code:
This helps ensure autoplay and inline rendering:
Code snippet (placed between <script>
tags):
`document.addEventListener('DOMContentLoaded', function() {
var videos = document.querySelectorAll('video');
videos.forEach(function(video) {
video.setAttribute('playsinline', '');
video.setAttribute('muted', '');
video.setAttribute('autoplay', '');
});
});`
This code augments Webflow’s native settings to reinforce playsinline, autoplay, and muted attributes—Safari requires them explicitly.
You can enhance autoplay compatibility in Safari with muted, playsinline, and autoplay attributes via custom JavaScript. However, autoplay will still not work in Low Power Mode on Safari, and the play button is unavoidable. Use a fallback image to maintain a consistent user experience.