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); }); }