Hi.
I would like to share a little JS-code that make video backgrounds to work on all devices.
Feel free to use it.
I use this JS-code on this website: www.stayalive.se
const $videos = [...document.querySelectorAll(".x-video.player script")];
$videos.map( video => {
video.innerText = video.innerText.replace(" muted>"," muted playsinline>");
});
window.addEventListener('load', () => {
const videos = document.querySelectorAll('video.x-mejs')
window.addEventListener('resize', () => {
for(let video of videos) {
video.dispatchEvent(new Event('playing'))
}
})
})
