Start date
End date
HTML
<div style="height: 200px; width: 940px; position:relative; overflow:hidden; left:50%; margin-left:-470px">
<div id="bg" style="background-image: url(http://www.lifo.gr/files/images/Julieta_940x200.png); height: 200px; width: 940px; cursor: pointer; z-index: 1; position:absolute">
</div>
<div id="video" style="background-color: #000; left: 512px; position: absolute; top: -77px; z-index: 0;"></div>
</div>
<script src="https://www.youtube.com/iframe_api"></script>
<script type="text/javascript">
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('video', {
width: '391px',
height: '350px',
videoId: 'J7T5MNBgGus',
playerVars: {'controls': 0, 'modestbranding': 0, 'showinfo': 0, 'start':0, 'loop':true, 'rel':0 },
events: {'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange,},
});
function onPlayerReady(event) {player.playVideo();
event.target.setVolume(0);
player.setPlaybackQuality("small");
var soundOn = document.getElementById("bg");
soundOn.addEventListener("mouseover", function() {
event.target.setVolume(80);
});
soundOn.addEventListener("mouseout", function() {
event.target.setVolume(0);
});
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED) {
player.playVideo();
player.setPlaybackQuality("small");
event.target.seekTo(0);}}
}
</script>