最早的时候是做了一个视频上传的功能 由于业务原因 除视频外还需要上传缩略图
于是乎:
/*****************分界线***********************************************/
var userId = wx.getStorageSync("userId");
var resurl = app.globalData.resurl;
//选择视频
wx.chooseVideo({
sourceType: ['album', 'camera'],
maxDuration: 60,
camera: 'back',
success: function(res) {
console.log(res);
wx.showLoading({
title: "正在上传视频",
})
//上传视频
wx.uploadFile({
url: resurl + "/cosUpload/upload.shtml",
formData: {
filePath: "xcx/groupBug/" + userId + "/titleImg/video/"
},
filePath: res.tempFilePath,
name: "file",
success: function(data) {
console.log(data);
//上传视频缩略图
wx.uploadFile({
url: resurl + "/cosUpload/upload.shtml",
formData: {
filePath: "xcx/groupBug/" + userId + "/titleImg/video/"
},
filePath: res.thumbTempFilePath,
name: "file",
success: function(ress) {
that.setData({
video: data.data,
videothumbTempFilePath: ress.data
})
wx.hideLoading()
}
})
}
});
},
fail: function(res) {
console.log(res);
}
})
/******分界线***********************************************/
然而 在真机测试的时候发现API没有返回预览图
后期修改的时候 发现小程序的 wx.chooseVideo API报错
有没有大神关于视频缩略图这部分的解决办法 可以分享一下么
QQ:3045798077