struct.go 4.4 KB
package aliyun

import "fmt"

var (
	OssErrFileFormat = fmt.Errorf("文件格式有错")
)

//创建视频上传凭证
/*CreateUploadVideo */
type CreateUploadVideoRequest struct {
	FileName string `json:"fileName"`
	Title    string `json:"title"`
}

type CreateUploadVideoResponse struct {
	FileName      string `json:"fileName"`
	RequestId     string `json:"requestId"`
	VideoId       string `json:"videoId"`
	UploadAddress string `json:"uploadAddress"`
	UploadAuth    string `json:"uploadAuth"`
	FileURL       string `json:"fileURL"`
}

/*CreateUploadVideos */
type CreateUploadVideosRequest struct {
	Items []*CreateUploadVideoRequest `json:"items"`
}
type CreateUploadVideosResponse struct {
	List []*CreateUploadVideoResponse `json:"list"`
}

//刷新视频上传凭证 RefreshUploadVideo
type RefreshUploadVideoRequest struct {
	VideoId string `json:"videoId" valid:"Required;"`
}

type RefreshUploadVideoResponse struct {
	RequestId     string `json:"requestId"`
	VideoId       string `json:"videoId"`
	UploadAddress string `json:"uploadAddress"`
	UploadAuth    string `json:"uploadAuth"`
	FileURL       string `json:"fileURL"`
}

/*GetPlayInfo 获取播放信息*/
type GetPlayInfoRequest struct {
	VideoId string `json:"videoId" xml:"VideoId"`
}

// GetPlayInfoResponse is the response struct for api GetPlayInfo
type GetPlayInfoResponse struct {
	//*responses.BaseResponse
	//RequestId    string                    `json:"RequestId" xml:"RequestId"`
	VideoBase    VideoBase                 `json:"VideoBase" xml:"VideoBase"`
	PlayInfoList PlayInfoListInGetPlayInfo `json:"PlayInfoList" xml:"PlayInfoList"`
}

/*获取视频播放凭证*/
type GetVideoPlayAuthRequest struct {
	VideoId string `json:"videoId" xml:"VideoId"`
}

// VideoBase is a nested struct in vod response
type VideoBase struct {
	OutputType    string `json:"OutputType" xml:"OutputType"`
	CoverURL      string `json:"CoverURL" xml:"CoverURL"`
	Duration      string `json:"Duration" xml:"Duration"`
	Status        string `json:"Status" xml:"Status"`
	Title         string `json:"Title" xml:"Title"`
	VideoId       string `json:"VideoId" xml:"VideoId"`
	MediaType     string `json:"MediaType" xml:"MediaType"`
	CreationTime  string `json:"CreationTime" xml:"CreationTime"`
	TranscodeMode string `json:"TranscodeMode" xml:"TranscodeMode"`
	//ThumbnailList ThumbnailListInGetPlayInfo `json:"ThumbnailList" xml:"ThumbnailList"`
}

type PlayInfoListInGetPlayInfo struct {
	PlayInfo []PlayInfo `json:"PlayInfo" xml:"PlayInfo"`
}

// PlayInfo is a nested struct in vod response
type PlayInfo struct {
	JobId            string `json:"JobId" xml:"JobId"`
	Format           string `json:"Format" xml:"Format"`
	PreprocessStatus string `json:"PreprocessStatus" xml:"PreprocessStatus"`
	EncryptType      string `json:"EncryptType" xml:"EncryptType"`
	Fps              string `json:"Fps" xml:"Fps"`
	ModificationTime string `json:"ModificationTime" xml:"ModificationTime"`
	NarrowBandType   string `json:"NarrowBandType" xml:"NarrowBandType"`
	Bitrate          string `json:"Bitrate" xml:"Bitrate"`
	Encrypt          int64  `json:"Encrypt" xml:"Encrypt"`
	Rand             string `json:"Rand" xml:"Rand"`
	CreationTime     string `json:"CreationTime" xml:"CreationTime"`
	StreamType       string `json:"StreamType" xml:"StreamType"`
	Height           int64  `json:"Height" xml:"Height"`
	WatermarkId      string `json:"WatermarkId" xml:"WatermarkId"`
	Duration         string `json:"Duration" xml:"Duration"`
	Complexity       string `json:"Complexity" xml:"Complexity"`
	Width            int64  `json:"Width" xml:"Width"`
	Size             int64  `json:"Size" xml:"Size"`
	Status           string `json:"Status" xml:"Status"`
	Definition       string `json:"Definition" xml:"Definition"`
	Plaintext        string `json:"Plaintext" xml:"Plaintext"`
	PlayURL          string `json:"PlayURL" xml:"PlayURL"`
	Specification    string `json:"Specification" xml:"Specification"`
}

//GetVideoPlayAuthResponse is the response struct for api GetVideoPlayAuth
type GetVideoPlayAuthResponse struct {
	RequestId string    `json:"requestId" xml:"RequestId"`
	PlayAuth  string    `json:"playAuth" xml:"PlayAuth"`
	VideoMeta VideoMeta `json:"videoMeta" xml:"VideoMeta"`
}

// VideoMeta is a nested struct in vod response
type VideoMeta struct {
	CoverURL string  `json:"coverURL" xml:"CoverURL"`
	Duration float64 `json:"duration" xml:"Duration"`
	Status   string  `json:"-" xml:"Status"`
	Title    string  `json:"title" xml:"Title"`
	VideoId  string  `json:"videoId" xml:"VideoId"`
}