代码如下:
var fileurl = URL.createObjectURL(file); //经测试,发现audio也可获取视频的时长 var audioElement = new Audio(fileurl); var duration; audioElement.addEventListener("loadedmetadata", function (_event) { duration = audioElement.duration; console.log( "duration"); console.log(duration);//单位:秒 }); //获取文件大小 var size = file.size;//单位:字节(byte)
.