Commit fc8d454a authored by 乐宝呗666's avatar 乐宝呗666

修改20s问题

parent 3a7b46a5
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<img src="@/assets/images/applets/tip.png" alt /> <img src="@/assets/images/applets/tip.png" alt />
<span> <span>
最多支持上传 最多支持上传
<b>3</b> 段视频,每段时长 <b>20s</b> <b>3</b> 段视频,每段时长 <b>30s</b>
</span> </span>
</div> </div>
</div> </div>
...@@ -200,20 +200,21 @@ export default { ...@@ -200,20 +200,21 @@ export default {
this.showBoard = false; this.showBoard = false;
}, },
beforeVideo(file) { beforeVideo(file) {
console.log(file)
this.timeOutVideo = false this.timeOutVideo = false
let _URL = window.URL || window.webkitURL; let _URL = window.URL || window.webkitURL;
let videoUrl = _URL.createObjectURL(file); let videoUrl = _URL.createObjectURL(file);
let audioElement = new Audio(videoUrl); let audioElement = new Audio(videoUrl);
audioElement.addEventListener("loadedmetadata", () => { audioElement.addEventListener("loadedmetadata", () => {
let duration = audioElement.duration; //时长为秒,小数,182.36 let duration = audioElement.duration; //时长为秒,小数,182.36
if (duration > 21) { if (duration > 31) {
this.timeOutVideo = true this.timeOutVideo = true
this.fileList.forEach((item,index)=>{ this.fileList.forEach((item,index)=>{
if(item.file.lastModified===file.lastModified){ if(item.file.lastModified===file.lastModified){
this.fileList.splice(index,1) this.fileList.splice(index,1)
} }
}) })
this.$toast.fail("上传视频时长不能超过20秒"); this.$toast.fail("上传视频时长不能超过30秒");
return false; return false;
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment