this.selectComponent('#modal').showModal({
title: '温馨提示',
content: '请上传8-45秒的视频~',
confirmText: '选择视频',
cancelText: '取消',
btnStyle: 'plain',
showCancel: true,
icon: ``,
confirm: () => {
app.globalData.notInit = true
wx.chooseMedia({
count: 1,
mediaType: ['video'],
sourceType: ['album', 'camera'],
maxDuration: 45,
camera: 'back',
success: (res) => {
let duration = res.tempFiles[0].duration
if (duration > 45 || duration < 8) {
wx.showToast({
title: '抱歉,请上传8-45s的视频',
icon: "none",
duration: 3000
});
setTimeout(() => {
app.globalData.notInit = false
}, 500);
return;
}
if (res.type !== 'video') {
wx.showToast({
title: '抱歉,请选择要上传的视频',
icon: "none",
});
setTimeout(() => {
app.globalData.notInit = false
}, 500);
return;
}
app.globalData.notInit = false
},
fail: () => {
wx.showToast({
title: '已取消',
icon: "none",
});
app.globalData.notInit = false;
},
complete: () => {
app.globalData.notInit = false;
}
})
}
})

不符合标准的视频提供个demo吧