...
|
...
|
@@ -10,6 +10,7 @@ import ( |
|
|
comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time"
|
|
|
"opp/internal/utils"
|
|
|
"path"
|
|
|
"path/filepath"
|
|
|
"time"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -39,10 +40,13 @@ func InitVodClient(accessKeyId string, accessKeySecret string) (client *vod.Clie |
|
|
//获取视频上传地址和凭证,并创建视频信息
|
|
|
func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (response *CreateUploadVideoResponse, err error) {
|
|
|
request := vod.CreateCreateUploadVideoRequest()
|
|
|
request.Title = getFileName(FileVideo, "video_file.mp4")
|
|
|
request.FileName = getFileName(FileVideo, "video_file.mp4")
|
|
|
//request.CoverURL = "http://img.alicdn.com/tps/TB1qnJ1PVXXXXXCXXXXXXXXXXXX-700-700.png"
|
|
|
//request.Tags = "tag1,tag2"
|
|
|
filePath := getFileName(FileVideo, r.FileName)
|
|
|
if filepath.Ext(r.FileName) == "mp3" {
|
|
|
filePath = getFileName(FileVideo, r.FileName)
|
|
|
}
|
|
|
request.Title = filePath
|
|
|
request.FileName = filePath
|
|
|
//request.StorageLocation = filepath.Base(filePath)
|
|
|
request.AcceptFormat = "JSON"
|
|
|
rsp, err := client.CreateUploadVideo(request)
|
|
|
if err != nil {
|
...
|
...
|
@@ -60,9 +64,12 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons |
|
|
//获取图片上传地址和凭证,并创建视频信息
|
|
|
func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (response *CreateUploadImageResponse, err error) {
|
|
|
request := vod.CreateCreateUploadImageRequest()
|
|
|
request.ImageType = "cover"
|
|
|
filePath := getFileName(FileImage, r.FileName)
|
|
|
request.ImageType = "default"
|
|
|
request.Title = filePath
|
|
|
request.ImageExt = filepath.Ext(r.FileName)
|
|
|
request.AcceptFormat = "JSON"
|
|
|
request.ImageExt = "jpg"
|
|
|
//request.StorageLocation = filepath.Base(request.Title)
|
|
|
rsp, err := client.CreateUploadImage(request)
|
|
|
if err != nil {
|
|
|
return
|
...
|
...
|
|