// 4. The API will call this function when the video player is ready. function onPlayerReady(event) { player.loadVideoById(document.getElementById('videoID').value); event.target.playVideo(); } var myTimer; function onPlayerStateChange(event){ if(event.data==1) { // playing myTimer = setInterval(function(){ var time; time = player.getCurrentTime(); HH = Math.floor(time / 3600); time %= 3600; MM = Math.floor(time / 60); SS = time % 60; if (HH < 10) {HH = "0"+HH;} if (MM < 10) {MM = "0"+MM;} if (SS < 10) {SS = "0"+SS;} time2 = HH+':'+MM+':'+SS; $("#timeHolder").text(time2); }, 100); $("#play").hide(); $("#pause").show(); } else { // not playing clearInterval(myTimer); $("#pause").hide(); $("#play").show(); } } function stop() { player.stopVideo(); } function play() { player.playVideo(); } function pause() { player.pauseVideo(); } function seekTo(seconds, allowSeekAhead) { player.seekTo(seconds, allowSeekAhead); } function destroyClickedElement(event) { document.body.removeChild(event.target); } var height=$(window).innerHeight(); var width=$(window).innerWidth(); var videoHeight=$('#player_ctrls').height(); var menu=$('.btn-group').height(); if (width < 768) { var scrollHeight = height-videoHeight-menu-60; } else { var scrollHeight=videoHeight;} $(document).ready(function(){ $('#description').css('height', scrollHeight); $('#q').css('padding',''); });