FLASH SALE Get 20% OFF everything using the coupon code: FLASH20 View WordPress Plugins →

How to Autoplay a Video Element Using JavaScript

on in Methods, Events and Scopes, JavaScript DOM
Last modified on

The latest Chrome version has stopped video autoplay if the video is not muted. Firefox and the other browsers will soon follow suit. Here’s a quick way to mute the video and autoplay it when the page has loaded:

function toggleMute(element) {
    element.muted = true;

window.addEventListener('load', () => {
    setTimeout(() => {
    }, 1000);

That’s it! Enjoy!

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *