I’m attempting to use a YouTube video as a background but am unable to set the following parameters using The YouTube video API
'autoplay': 1, 'controls': 0, 'mute' : 1, 'loop': 1
I’ve set my example on CodePen.
https://codepen.io/randometc/pen/GBXvKP
The function onYouTubeIframeAPIReady()
seems to be working(?) because the onStateChange function is firing.
function onYouTubeIframeAPIReady() {
player = new YT.Player('existing-iframe-example', {
videoId: 'cLzY3cmrgIU',
playerVars: {'autoplay': 1, 'controls': 0, 'mute' : 1, 'loop': 1 },
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
But the PlayerVars are not being read at all.