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.
educoder/app/libs/aliyun_vod/service/video_upload.rb

39 lines
977 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 视频上传
module AliyunVod::Service::VideoUpload
# 获取视频上传地址和凭证
def create_upload_video(title, filename, **opts)
params = {
Action: 'CreateUploadVideo',
Title: title,
FileName: filename
}.merge(base_params)
# TODO 获取视频的同时,可以指定转码组,在这里指定
# 参数TemplateGroupId 转码组的id.
# 分类
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