Autoplay video attribute not working

Hello,
I was playing around with the element of html, and I noticed that it autoplay doesn’t actually work. This is the code:

<video src="https://codecademy-content.s3.amazonaws.com/courses/Semantic+HTML/dog+video.mp4" autoplay controls >
      </video>

and this is the link to the lesson:
link

I’ve tried loop and controls, and they both work fine. Am I doing something wrong here?
Thank you for your help in advance

1 Like

In some browsers (e.g. Chrome 70.0) autoplay doesn’t work if no muted attribute is present. -MDN

Autoplay will work on Chrome if the video is muted, you can just add the word muted after autoplay

Autoplay Policy Changes - Google

8 Likes

I am using edge but its still not working.

Hi and welcome!

Would you mind showing us your code? If you decide to do so, remember posting code like this.

Although able to autoplay videos in html but unable to unmute the video. Below is the code:

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Document</title>
<video id="myvideo" src="vid.mp4" controls muted autoplay loop width="400"></video>

<script>

    function toggleMute() 

    {

        var video = document.getElementById("myvideo");

        if (video.muted) 

        {

            video.muted = false;

        } 

        else 

        {

            debugger;

            video.muted = true;

            video.play()

        }

    }

    $(document).ready(function () 

    {

        setTimeout(toggleMute, 3000);

    }

    )

</script>