var videotimer = md5($('#time').val()); var HH = 0; var mm = 0; var ss = 0; var x=1; var str = ''; //var timer = setInterval(gettimer,1000); var timer; function gettimer(){ str = ""; if(++ss==60) { if(++mm==60) { HH++; mm=0; } ss=0; } str+=HH<10?"0"+HH:HH; str+=":"; str+=mm<10?"0"+mm:mm; str+=":"; str+=ss<10?"0"+ss:ss; document.getElementById("dtime").innerHTML = str; localStorage.setItem(videotimer,HH*3600+mm*60+ss); var doness = $('#doness').val(); var nowss = parseInt(doness)+1; var now = Math.floor(nowss/3600*100)/100; var totalss = $('#totalss').val(); var progress = Math.floor(nowss/totalss*100); $('.done_progress').text(progress); $('.done_noprogress').text(100-parseInt(progress)); $('#noprogresstar').css('width',(100-parseInt(progress))+'%'); $('#progresstar').css('width',progress+'%'); $('.done_hh').text(now); $('#doness').val(nowss); if(nowss == totalss){ $('#finishClass').show(); $('#classStatus').html('已完成本课程学习'); clearInterval(timer); myPlayer.pause(); updatedata(); } if(HH*3600+mm*60+ss == 60*5*x){ updatedata(); if(x%2 == 0) { clearInterval(timer); $('#videoValidate').show(); $('.bodyBg').show(); myPlayer.pause(); } x++; } } function starttimer(){ timer = setInterval(gettimer,1000); myPlayer.play(); $('#videoValidate').hide(); $('.bodyBg').hide(); } function startclass(){ $('#videoTips').hide(); $('.bodyBg').hide(); timer = setInterval(gettimer,1000); myPlayer.setDataSource({type: videotype, src: videosrc}); myPlayer.seekTo(parseInt(videotime)*1000); myPlayer.play(); }