var player1
var player2
var player3
var player4
function onYouTubeIframeAPIReady() {
player1 = new YT.Player('player1', {
height: '248',
width: '330',
videoId: 'YMvT7VqGVHw',
playerVars: {
'autoplay': '0',
'rel': '0',
'loopplaylist': '0',
'showinfo': '0',
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
},
playerVars: {
'autoplay': '0',
'rel': '0',
'loopplaylist': '0',
'showinfo': '0',
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.mute();
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
event.target.mute();
// if (event.data == YT.PlayerState.PLAYING && !done) {
// setTimeout(stopVideo, 6000);
// done = true;
// }
}
function stopVideo() {
player.stopVideo();
}