I've embed a Youtube playlist on my website.
Once a video finishes the player doesn't play the next video but skips it and plays the one after. It does it whatever the video. Why is that and how to make it play all videos one after the other ?
Here's my web site with the embed playlist : http://www.centpourcentmonnaie.fr
And here is my code :
<div class="video">
<p>
<span id="gauche" onclick="player.previousVideo()">Chapitre précédent</span>
<span id="droite" onclick="player.nextVideo()">Chapitre suivant</span>
</p>
<div id="player"></div>
<script>
var tag = document.createElement('script');
tag.src = "//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: '720',
width: '1280',
videoId: '3BuJ4RWy49k',
events: {
'onReady': onPlayerReady,
}
});
}
function onPlayerReady(event) {
event.target.cuePlaylist({list: "PLE_-2rZv8j2ro-QgxzK9nvi9O61dgE-Hx",suggestedQuality: "hd720"});
}
</script>
<br>
</p>
</div>
</div>
The console can read different things in different web browsers.