Video is not playing automatically in React JS

Hy, I want to play videos automatically without controls. because I’m using it as a website banner background. Please point out what I have done wrong. I’m using chrome browser.

  <video
          autoPlay
          // playsinline
          autoplay
          muted
          loop
          className="stakingNft"
        >
        <source src="\assets\video\landing.mp4" type="video/mp4" />  
  </video>

--------------------------------

  <video
          autoPlay
          playsinline
          autoplay
          muted
          loop
          className="stakingNft"
        >
        <source src="\assets\video\landing.mp4" type="video/mp4" />  
  </video>

>Solution :

Here is the codesandbox

autoPlay might be defined twice and in small case that’s the reason I think.

Leave a Reply