Tengo el siguiente código que funciona correctamente, lo que no se hacer es para pasarle un array de videos y que sean consecutivos y haga un loop.
Código HTML:
<!DOCTYPE HTML>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
body
{
margin:0;padding:0;
}
#player_wrap{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}
#player_wrap iframe{position:absolute;top:0;left:0;width:100%;height:100%}
</style>
</head>
<body>
<script>
function inicio_galeria() {
$('#player_wrap').remove();
$('#pase').camera({
fx: 'simpleFade',
pagination: true,
height: 'auto',
time: 5000,
autoAdvance:true,
thumbnails: true
});
}
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: '100%',
width: '100%',
videoId: 'vabnZ9-ex7o',
playerVars: {
showinfo: 0,
rel: 0,
controls: 0
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
event.target.mute();
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED) {
//Iniciar funcion
}
}
</script>
<div id="player_wrap"><div id="player"></div>
</body>
</html>