',
});
$("#videoCarousel").on('slide.bs.carousel',function(event){
console.log('carrusel has changed');
$.each(players, function(i, player){
player.stopVideo();
});
});
});
var tag = document.createElement('script');
tag.id = 'yt-script';
tag.src = 'https://www.youtube.com/iframe_api';
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
console.log('yt scripts loaded');
var player, players=[];
function onYouTubeIframeAPIReady() {
player = new YT.Player('yt-iframe', {
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
$.each(videos,function(i,id){
players.push(
new YT.Player('Iframe_' +id, {
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
})
);
});
}
function onPlayerReady(event) {
console.log('video player ready');
}
function onPlayerStateChange(event) {
console.log('state has changed');
console.log(event.data);
$("#videoCarousel").carousel("pause");
}
-->