You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
JiangningUrbanManagePc/src/views/components/videoFileUpload/index.vue

47 lines
1.0 KiB

<!--
* @Descripttion:
* @version:
* @Author: JC9527
* @Date: 2023-12-26 18:01:27
* @LastEditors: JC9527
* @LastEditTime: 2023-12-26 18:26:14
-->
<template>
<div class="component-upload-image">
<el-upload
class="upload-demo-video"
ref="upload"
:auto-upload="false"
:multiple="false"
action="http://up-z2.qiniu.com"
:on-success="successVideo"
:show-file-list="false"
>
<i class="el-icon-plus"></i>
</el-upload>
</div>
</template>
<script>
export default {
data() {
return {
fileList:[]
}
},
methods:{
successVideo(response, file, fileList) {
var url = URL.createObjectURL(fileList[0].raw);
var audioElement = new Audio(url);
var duration;
audioElement.addEventListener("loadedmetadata",function() {
duration =parseInt(audioElement.duration) ; //时长为秒
console.log(duration);
});
}
},
}
</script>
<style lang="scss" scoped>
</style>