feross/yt-player

There is an autoplay problem

dghojas opened this issue · 2 comments

Hi everyone, I am testing the video with autoplay but it doesn't work.

`
const idHeader = document.querySelector('.header-video');
const player = new YTPlayer('#player', {
width: '100%',
fullscreen: true,
autoplay: true,
controls: false,
captions: false,
modestBranding: false,
related: false,
});

const index = idHeader.dataset.id;
player.load(index, [true, 0]);

`

Help me how to solve the issue.
Thanks You!

I use player.on('unstarted', () => player.play()) to get autoplay to work.

Yes now, thank you! 🙌🏼 @coronary