selectVideo() {
uni.chooseMedia({
count: this.MAXNUM,
mediaType: ["video"],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: "back",
sizeType:['original'],
compressed:false,
success: async (res) => {
const files = res.tempFiles;
if (files.length > 0) {
this.upLoading = true;
for (let i = 0; i < files.length; i++) {
const fileObj = files[i];
//为处理是否有重复视频
VideoAddList.push({
path: fileObj.tempFilePath,
});
//渲染上传列表
let viewData = {
vido_url: fileObj.tempFilePath, //VideoAddList[VideoAddList.length-1].path
server_path: null, //服务器资源地址
del: false, //删除状态
cover: fileObj.thumbTempFilePath,
compress: true, //压缩中
upRate: 1, //上传进度
error: false, //上传失败
};
this.video.push(viewData);
//有待验证逻辑
const currentView = this.video[this.video.length - 1];
//判定是否超出数量
if (this.video.length >= 8) {
this.canUpVideo = false;
}
//刷新path与index对应关系
this.reloadVideoIndex();
// if (fileObj.size > this.MAX_SIZE && this.is_compress) {
// this.$refs.uTips.show({
// title: "视频文件较大,将在压缩后为您上传",
// type: "warning",
// duration: "2500",
// });
// this.videoCompressAndUpload(fileObj.tempFilePath, currentView);
// } else {
// currentView.compress = false;
// this.videoUpload(fileObj.tempFilePath, currentView);
// }
if (i === files.length - 1) {
this.upLoading = false;
}
}
} else {
this.upLoading = false;
}
},
});
},