在开发过程中,上传视频到腾讯云,在开发者工具上和IOS手机可以上传成功,Android机上传失败
// 获取上传签名的函数
getSignature: function(callback) {
wx.request({
url: ‘https://xzb.qcloud.com/get_vod_sign’,
method: ‘POST’,
data: {
Action: ‘GetVodSignatureV2’
},
dataType: ‘json’,
success: function(res) {
if (res.data && res.data.data.signature) {
callback(res.data.data.signature);
} else {
return ‘获取签名失败’;
}
}
});
},
// 选择视频文件后上传视频到腾讯云
startUpload: function(videoFile) {
const that = this;
VodUploader.start({
mediaFile: videoFile, //必填,把chooseVideo回调的参数(file)传进来
getSignature: that.getSignature, //必填,获取签名的函数
// mediaName: that.setUploadVideoName(),
success: function (result) {
console.log(‘success’);
console.log(result);
},
error: function (result) {
console.log(‘error’);
console.log(result);
},
progress: function (result) {
console.log(‘progress’);
console.log(result);
wx.showLoading({
title: '上传中 ’ + result.percent * 100 + ‘%’,
});
},
finish: function (result) {
console.log(‘finish’);
console.log(result);
wx.hideLoading()
}
});
},