签名在验证工具中验证通过,
看network是发了两个请求:
index.php?Action=ApplyUploadUGC , 返回 {"code":10001,"message":"ugc upload | invalid request"}
vodreport.qcloud.com/ugcupload_new , 返回 {"code":0,"msg":"OK"}
求指点, 拜托, 以下是我的代码片段:
<script src="${base}/assets/plugins/jQuery/axios/axios.min.js"></script>
<script src="${base}/assets/plugins/jQuery/tenxun/vod-js-sdk-v6.js"></script>
<script>
//定义获取上传签名的函数
function getSignature() {
return axios.post('${base}/a/pubVideos/txSignature').then(function (response) {
return response.data;
})
};
//腾讯云上传
$(".wt-add").click(function () {
if(!$("#frameForm").valid())
return false;
var fromdata = getFromObj();
// console.log(getSignature)
WT.wt_confirm('是否发送?', function () {
var file = document.querySelector('input[type=file]').files[0];
console.log(file)
$("#uploadLoading").show();
const tcVod = new TcVod.default({
getSignature: getSignature // 前文中所述的获取上传签名的函数
})
const uploader = tcVod.upload({
mediaFile: file, // 媒体文件(视频或音频或图片),类型为 File
})
uploader.on('media_progress', function(info) {
console.log(info.percent) // 进度
loadPlan("loading",rinfo.percent);
})
// 回调
uploader.done().then(function (result) {
console.log(result)
fromdata.append('yx_course_id', result.fileId);
fromdata.append('course_url', result.video.url);
console.log(fromdata);
//保存
WT.wt_ajax_fileData('${base}/a/courseSeries/courseSeriesDetail_add',fromdata,function(data){
WT.wt_alert('发送成功');
WT.wt_reload_jqtable(this);
});
}).catch(function (err) {
// deal with error
console.log(err) // Error: ugc upload | invalid request
})
});
});
</script>
相似问题