This tutorial teaches you how to autoplay a video inside video module in Divi. Additionally it teaches you to loop too.
#divi #wordpress #autoplay #video #loop
Script used in this video (Please remember to add script tag around it)
document.addEventListener("DOMContentLoaded", function() {
var videoBoxes = document.querySelectorAll('.dm-autoplay-btn .et_pb_video_box');
if (videoBoxes.length !== 0) {
videoBoxes.forEach(function(videoBox) {
var video = videoBox.querySelector('video');
if (video) {
video.muted = true;
video.loop = true;
video.setAttribute('playsInline', '');
video.play();
}
});
}
});