<el-upload
    :on-change="uploadVideoChange">
    <el-button size="small" type="primary">
        <i class="el-icon-upload" />点击上传
    </el-button>
</el-upload>
uploadVideoChange (file, fileList) {
    // 防止触发两次
    if (file.status !== 'ready') return
    const getVideoInfo = new Promise((resolve) => {
        const videoElement = document.createElement("video");
        videoElement.src = URL.createObjectURL(file.raw);
        videoElement.addEventListener("loadedmetadata", function () {
            resolve({
          duration: videoElement.duration, height: videoElement.videoHeight, width: videoElement.videoWidth }); }); }); getVideoInfo.then((videoInfo)
=> { console.log(videoInfo); }) }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案