I posted the YouTube API and a video on my site a few days ago. I have set some PlayerVars. Everything worked then. Unfortunately, I noticed today that the player is not working properly anymore. All the PlayerVars are set in the iframe link, but they will not be executed (for example, 'showinfo': 0 will still display the video info). What can this be? Even if I remove all the changes I made since putting the video online, it will not work properly again.
HTML:
<div id="aboutVideoVideo"></div>
JavaScript:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('aboutVideoVideo', {
height: '100%',
width: '100%',
videoId: 'xxx_xx',
playerVars: {
'showinfo': 0,
'disablekb': 1,
'fs': 0,
'iv_load_policy': 3,
'modestbranding': 1,
'rel': 0
},
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
event.target.pauseVideo();
event.target.unMute();
}
iframe result:
<iframe id="aboutVideoVideo" frameborder="0" allowfullscreen="1" allow="autoplay; encrypted-media" title="YouTube video player" width="100%" height="100%" src="https://www.youtube.com/embed/xxx_xx?showinfo=0&disablekb=1&fs=0&iv_load_policy=3&modestbranding=1&rel=0&enablejsapi=1&origin=http%3A%2F%2Fxxx.xxx.xxx.xxx&widgetid=1"></iframe>