获取el-upload上传视频的视频时长

    // 获取视频时长
    getVideoTime(file) {
      let that = this
      var url = URL.createObjectURL(file.raw);
      var audioElement = new Audio(url);
      var duration;
      audioElement.addEventListener("loadedmetadata",
        function () {
          duration = parseInt(audioElement.duration); //时长为秒,取整  
          that.editDialog.data.duration = duration        
        });
    },

你可能感兴趣的:(前端,css,Java,Web,javascript,前端,vue.js)