var RPCClient = require('@alicloud/pop-core').RPCClient;
//初始化客户端
function initVodClient(accessKeyId, secretAccessKey,) {
var regionId = 'cn-shanghai'; // 点播服务接入区域
var client = new RPCClient({
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
apiVersion: '2017-03-21'
});
return client;
}
//获取视频上传地址和凭证
export function creatUploadInfo (AccessKeyId,AccessKeySecret){
debugger
var client = initVodClient(AccessKeyId,AccessKeySecret);
debugger
client.request("CreateUploadVideo", {
Title: 'this is a sample',
FileName: 'filename.mp4'
}, {}).then(function (response) {console.log("success=====>>>>>",response)
console.log('VideoId = ' + response.VideoId);
console.log('UploadAddress = ' + response.UploadAddress);
console.log('UploadAuth = ' + response.UploadAuth);
console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
console.log("err====>>>",response)
// console.log('ErrorCode = ' + response.data.Code);
// console.log('ErrorMessage = ' + response.data.Message);
// console.log('RequestId = ' + response.data.RequestId);
});
}
调用creatUploadInfo 方法时控制台抛出错误如下:
TypeError: Cannot read property '_headers' of undefined at httpx.request.then (rpc.js:181)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。