【问题标题】:How can I get the duration of *.avi *.flv,*.rmvb files in JavaScript if the uploaded file is of type *.avi or *.flv?如果上传的文件是 *.avi 或 *.flv 类型,如何在 JavaScript 中获取 *.avi *.flv、*.rmvb 文件的持续时间?
【发布时间】: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


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-19
      • 2014-03-14
      • 1970-01-01
      • 2011-04-11
      • 1970-01-01
      • 2011-04-09
      • 1970-01-01
      • 2013-08-11
      相关资源
      最近更新 更多