JavaScript 获取视频时长的时分秒
2021-06-05 09:02
标签:bre ret display duration ati 时长 val var style JavaScript 获取视频时长的时分秒 标签:bre ret display duration ati 时长 val var style 原文地址:https://www.cnblogs.com/czf1987/p/14633401.html
function getDuration(value,dateFormat){
let hour = parseInt((value) / 3600);
if (hour hour = "0" + hour;
}
var minute = parseInt((value % 3600) / 60);
if (minute minute = "0" + minute;
}
var second = Math.ceil(value % 60);
if (second second = "0" + second;
}
switch (dateFormat) {
case ‘hh:mm‘:
return hour + ":" + minute;
break;
case ‘mm:ss‘:
return minute + ":" + second;
break;
case ‘hh‘:
return hour;
break;
default:
return hour + ":" + minute + ":" + second;
break;
}