|
@ -411,6 +411,61 @@ func InvokeSpriteSnapshotTask() { |
|
|
fmt.Printf("%+v\n", DescribeJobRes.JobsDetail) |
|
|
fmt.Printf("%+v\n", DescribeJobRes.JobsDetail) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func InvokeSegmentTask() { |
|
|
|
|
|
u, _ := url.Parse("https://wwj-cq-1253960454.cos.ap-chongqing.myqcloud.com") |
|
|
|
|
|
cu, _ := url.Parse("https://wwj-cq-1253960454.ci.ap-chongqing.myqcloud.com") |
|
|
|
|
|
b := &cos.BaseURL{BucketURL: u, CIURL: cu} |
|
|
|
|
|
c := cos.NewClient(b, &http.Client{ |
|
|
|
|
|
Transport: &cos.AuthorizationTransport{ |
|
|
|
|
|
SecretID: os.Getenv("COS_SECRETID"), |
|
|
|
|
|
SecretKey: os.Getenv("COS_SECRETKEY"), |
|
|
|
|
|
Transport: &debug.DebugRequestTransport{ |
|
|
|
|
|
RequestHeader: true, |
|
|
|
|
|
// Notice when put a large file and set need the request body, might happend out of memory error.
|
|
|
|
|
|
RequestBody: true, |
|
|
|
|
|
ResponseHeader: true, |
|
|
|
|
|
ResponseBody: true, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
// DescribeMediaProcessQueues
|
|
|
|
|
|
DescribeQueueOpt := &cos.DescribeMediaProcessQueuesOptions{ |
|
|
|
|
|
QueueIds: "", |
|
|
|
|
|
PageNumber: 1, |
|
|
|
|
|
PageSize: 2, |
|
|
|
|
|
} |
|
|
|
|
|
DescribeQueueRes, _, err := c.CI.DescribeMediaProcessQueues(context.Background(), DescribeQueueOpt) |
|
|
|
|
|
log_status(err) |
|
|
|
|
|
fmt.Printf("%+v\n", DescribeQueueRes) |
|
|
|
|
|
// CreateMediaJobs
|
|
|
|
|
|
createJobOpt := &cos.CreateMediaJobsOptions{ |
|
|
|
|
|
Tag: "Segment", |
|
|
|
|
|
Input: &cos.JobInput{ |
|
|
|
|
|
Object: "input/117374C.mp4", |
|
|
|
|
|
}, |
|
|
|
|
|
Operation: &cos.MediaProcessJobOperation{ |
|
|
|
|
|
Output: &cos.JobOutput{ |
|
|
|
|
|
Region: "ap-chongqing", |
|
|
|
|
|
Object: "output/abc-${Number}.mp4", |
|
|
|
|
|
Bucket: "wwj-cq-1253960454", |
|
|
|
|
|
}, |
|
|
|
|
|
Segment: &cos.Segment{ |
|
|
|
|
|
Format: "mp4", |
|
|
|
|
|
Duration: "10", |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
QueueId: DescribeQueueRes.QueueList[0].QueueId, |
|
|
|
|
|
} |
|
|
|
|
|
createJobRes, _, err := c.CI.CreateMediaJobs(context.Background(), createJobOpt) |
|
|
|
|
|
log_status(err) |
|
|
|
|
|
fmt.Printf("%+v\n", createJobRes.JobsDetail) |
|
|
|
|
|
|
|
|
|
|
|
// DescribeMediaJobs
|
|
|
|
|
|
DescribeJobRes, _, err := c.CI.DescribeMediaJob(context.Background(), createJobRes.JobsDetail.JobId) |
|
|
|
|
|
log_status(err) |
|
|
|
|
|
fmt.Printf("%+v\n", DescribeJobRes.JobsDetail) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|
// InvokeSnapshotTask()
|
|
|
// InvokeSnapshotTask()
|
|
|
// InvokeConcatTask()
|
|
|
// InvokeConcatTask()
|
|
@ -418,5 +473,6 @@ func main() { |
|
|
// InvokeMultiTasks()
|
|
|
// InvokeMultiTasks()
|
|
|
// TaskNotifyCallback()
|
|
|
// TaskNotifyCallback()
|
|
|
// WorkflowExecutionNotifyCallback()
|
|
|
// WorkflowExecutionNotifyCallback()
|
|
|
InvokeSpriteSnapshotTask() |
|
|
|
|
|
|
|
|
// InvokeSpriteSnapshotTask()
|
|
|
|
|
|
InvokeSegmentTask() |
|
|
} |
|
|
} |