S
S
Sergey2018-08-09 08:43:18
YouTube
Sergey, 2018-08-09 08:43:18

How to automatically start playing youtube videos on a website in chrome?

Not so long ago , the video autoplay policy changed in chrome , in connection with this, the question is: how is it normal to automatically launch videos from YouTube? Now it starts, only after reloading the page.

It used to work like this
function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          videoId: 'VIDEO_ID',
          playerVars: {'controls': 0, 'showinfo': 0, 'rel': 0, 'autoplay': 1, 'loop': 1},
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

UPD
Should have just added 'mute':1 to playerVars

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lojcin, 2018-08-09
@lojcin

5b6c907ad2cba693595550.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question