What is the error customization of the player?

var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

youtubeStyle function(player,playerID,videoID) {

 onYouTubeIframeAPIReady = function () {
 player = new YT.Player(playerID, {
 height: '620',
 width: '350',
 videoId: videoID, // youtube video id
 playerVars: {
 'autoplay': 0,
 'rel': 0,
 'showinfo': 0
},
 events: {
 'onStateChange': onPlayerStateChange
}
});
}

 onPlayerStateChange = function (event) {
 if (event.data == YT.PlayerState.ENDED) {
$('.start-video').fadeIn('normal');
$('.play-icon').fadeIn('normal');
}
}

 $('.start-video').click(function() {
$(this).fadeOut('normal');
$(this).children().fadeOut('normal');
player.playVideo();
})
 $('.play-icon').click(function() {
$(this).fadeOut('normal');
$(this).parent().fadeOut('normal');
player.playVideo();
})
}
var video = new Array;

Make a custom player, one was able a few such a way does not want
Call functions here as below
<div class="video-abs-start-video">
 <img src="../img/pl-ic.png" alt class="play-icon start-video">
</div>
 <div id="play-1">
the <script>
 $( document ).ready(function() {
youtubeStyle(video[1],'play 1','SMVHbKgV3Y4');
});
</script>
 </div>

again, one player runs and 2 no.
July 2nd 19 at 17:45
1 answer
July 2nd 19 at 17:47
well, I have a function in fact, I put a(created player) and put in another (created player) but this button is my first works on the second not. Here is the same example only in a loop, I loop is not needed - Cristian_Satterfield commented on July 2nd 19 at 17:50

Find more questions by tags YouTubeCSSHTMLJavaScript