I am struggling with setting up the loop for youtube videos using youtube player api.
The problem is that the video is not running under a loop.
Here is my code
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('player', {
height: '390',
width: '640',
playerVars: {
'controls': 0,
'showinfo': 0,
'rel': 0,
'loop': 1
},
videoId: 'qzZuBWMnS08',
events: {
'onReady': onPlayerReady,
// 'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
// event.target.setLoop(true);
event.target.playVideo();
}
The loop:1 doesn't seem to be working.Also is there any way to remove the share and video title from the top of the video.
Thanks in advance.