【发布时间】:2021-10-08 15:25:43
【问题描述】:
有我的代码,如果上传的文件是*.avi或*.flv类型,文件的时长将不会发送。如果是.wav的就可以了。
<input type="file" id="input">
var vid = document.createElement('video');
document.querySelector('#input').addEventListener('change', function() {
// create url to use as the src of the video
var fileURL = URL.createObjectURL(this.files[0]);
vid.src = fileURL;
// wait for duration to change from NaN to the actual duration
vid.ondurationchange = function() {
alert(this.duration);
};
});
【问题讨论】:
标签: video-streaming html5-video media-player media