同一个视频有时候是好的可以上传,有时候就chooseMedia:fail
报错{tempFiles: [], errMsg: "chooseMedia:fail ", type: "mix", failedCount: 1} "
有的视频就十几兆也会出现chooseMedia:fail
请问我是哪里写错了么,急急急!!!!
try {
wx.chooseMedia({
count: 9,
mediaType: ["mix"],
sourceType: ["album", "camera"], //图片来源
sizeType: ["original"], //compressed
success: ret => {
const fileArr = ret.tempFiles;
const uploadResult = [];
showOrHiddenLoading(true, true);
。。。。。。这里就fail了 {tempFiles: [], errMsg: "chooseMedia:fail ", type: "mix", failedCount: 1} "
上传部分的代码
async function signUploadVideo(file, params, successCb, failCb) {
const res = await getOssParams(params.mediationId, file.fileName);
console.log("获取oss配置", res);
return new Promise((resolve, reject) => {
showOrHiddenLoading(true, true);
const uploadTask = wx.uploadFile({
filePath: file.tempFilePath,
name: "file",
url: res.host,
header: {
"Content-Type": "multipart/form-data"
},
timeout: 1800000, //30分钟的请求超时时间 bug单52212
formData: {
key: res.fileName,
policy: res.policy,
OSSAccessKeyId: res.OSSAccessKeyId,
signature: res.signature,
success_action_status: "200" //让服务端返回200,不然,默认会返回204
},
success(resp) {
console.log("视频上传成功的回调", resp, res.host + "/" + file.fileName);
if (resp.statusCode === 200) {
resolve({
type: "video", // 标识 video image
statusCode: resp.statusCode, //状态码
url: res.host + "/" + res.fileName, //上传结果地址
tempFilePath: res.fileName //截取过的地址
// url: ossConfig.host + "/" + getOssKey(res.dir, file.fileName), //上传结果地址
// tempFilePath: getOssKey(res.dir, file.fileName) //截取过的地址
});
} else {
Taro.showToast({
title: "上传失败!",
icon: "none",
duration: 5000
});
reject("上传失败!");
}
},
@社区技术运营专员-Demons
@Cjiang
麻烦援助一下