
<video width="100%" height="100%" poster="img/vidoe_bg2.png" id="video">
<source src="mp4/shuchuangzhongxin (1).mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 HTML5 video 标签,请切换浏览器。
</video>
<span class="duration"></span>
</div>
var video = document.getElementById('video');
video.addEventListener("canplay", function () {
var timers = Math.ceil(this.duration);
$(".duration").text(timeToMinute(timers))
})
function timeToMinute(times) {
console.log('zyc11122');
console.log('zyc111');
var t;
if (times > -1) {
var hour = Math.floor(times / 3600);
var min = Math.floor(times / 60) % 60;
var sec = times % 60;
if (hour < 10) {
t = '0' + hour + ":";
} else {
t = hour + ":";
}
if (min < 10) {
t += "0";
}
t += min + ":";
if (sec < 10) {
t += "0";
}
t += sec.toFixed(2);
}
t = t.substring(0, t.length - 3);
return t;
console.log(456);
}