js音视频文件的时长
作者:互联网
function getTimes() { var obj_file = document.getElementById("upload"); var content = obj_file.files[0] console.log(content) //获取时长 var url = URL.createObjectURL(content) var audioElement = new Audio(url); var duration; audioElement.addEventListener("loadedmetadata", function (_event) { duration = audioElement.duration; console.log(duration/60); }); }
标签:console,js,content,duration,file,var,audioElement,音视频,时长 来源: https://www.cnblogs.com/tipsydr/p/14858820.html