<div class="video-noplay">
<video>
<source src="video.mp4">
</video>
</div>
<div class="autoplay">
<video>
<source src="video.mp4">
</video>
</div>
document.querySelector('.autoplay video').setAttribute('autoplay', ' ');
const attributes = ['mute', 'loop', 'autoplay'];
const video = document.querySelector('.autoplay video');
attributes.forEach(attr => video.setAttribute(attr, ''));
const video = document.querySelector('.autoplay video');
video.autoplay = true;
video.loop = true;
video.muted = true;