You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# 视频上传
|
|
|
|
module AliyunVod::Service::VideoUpload
|
|
|
|
# 获取视频上传地址和凭证
|
|
|
|
def create_upload_video(title, filename, **opts)
|
|
|
|
params = {
|
|
|
|
Action: 'CreateUploadVideo',
|
|
|
|
Title: title,
|
|
|
|
FileName: filename
|
|
|
|
}.merge(base_params)
|
|
|
|
|
|
|
|
# 分类
|
|
|
|
cate_id = AliyunVod.cate_id
|
|
|
|
params[:CateId] = cate_id if cate_id.present?
|
|
|
|
|
|
|
|
params = opts.merge(params)
|
|
|
|
|
|
|
|
result = request(:post, params)
|
|
|
|
|
|
|
|
raise AliyunVod::Error, '获取上传凭证失败' if result['UploadAddress'].blank?
|
|
|
|
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
# 刷新视频上传凭证
|
|
|
|
def refresh_upload_video(video_id)
|
|
|
|
params = {
|
|
|
|
Action: 'RefreshUploadVideo',
|
|
|
|
VideoId: video_id
|
|
|
|
}.merge(base_params)
|
|
|
|
|
|
|
|
result = request(:post, params)
|
|
|
|
|
|
|
|
raise AliyunVod::Error, '刷新上传凭证失败' if result['UploadAddress'].blank?
|
|
|
|
|
|
|
|
result
|
|
|
|
end
|
|
|
|
end
|