全部产品

云剪辑工程管理

本文介绍如何通过ICE Go SDK进行云剪辑工程管理。

云剪辑工程管理

通过SDK对云剪辑工程进行增删改查操作。

标题为创建云剪辑工程的必要参数,只有设置了timeline的云剪辑工程才能 提交剪辑合成作业

搜索云剪辑工程

通过 SearchEditingProjectRequest 接口对云剪辑工程进行检索。

支持通过创建时间、云剪辑工程状态 对云剪辑工程进行检索。

支持NextToken参数对云剪辑工程进行分页查询。

详见 搜索云剪辑工程 API。

代码示例

package main

import (
 "fmt"

 client2 "github.com/alibabacloud-go/darabonba-openapi/client"
 ice "github.com/alibabacloud-go/ice-20201109/client"
)

func main() {
 iceClient, err := InitICEClient("<yourAccessKeyId>", "<yourAccessKeySecret>")

 // 创建云剪辑工程
 title := "剪辑工程标题"
 description := "剪辑工程描述"
 timeLine :="{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****1656bca4474999c961a6d2a2****\"}]}]}"
 coverUrl := "http://****/coverUrl.jpg"

 createEditingProjectRequest := ice.CreateEditingProjectRequest {
  Title: &title,
  Description: &description,
  Timeline: &timeLine,
  CoverURL: &coverUrl,
 }
 createEditingProjectResult, err := iceClient.CreateEditingProject(&createEditingProjectRequest)
 fmt.Println(createEditingProjectResult, err)


 // 获取单个云剪辑工程
 projectId := "****4eb5fa69-56e1-4854-87e3-b0f1b6a9****"

 getEditingProjectRequest := ice.GetEditingProjectRequest{
  ProjectId: &projectId,
 }
 getEditingProjectResult, err := iceClient.GetEditingProject(&getEditingProjectRequest)
 fmt.Println(getEditingProjectResult, err)


 // 修改云剪辑工程
 updateTimeLine := "{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"}]}]}"

 updateEditingProjectRequest := ice.UpdateEditingProjectRequest{
  ProjectId: &projectId,
  Timeline: &updateTimeLine,
 }
 updateEditingProjectResult, err := iceClient.UpdateEditingProject(&updateEditingProjectRequest)
 fmt.Println(updateEditingProjectResult, err)

 // 删除云剪辑工程
 deleteEditingProjectsRequest := ice.DeleteEditingProjectsRequest{
  ProjectIds: &projectId,
 }
 deleteEditingProjectsResult, err := iceClient.DeleteEditingProjects(&deleteEditingProjectsRequest)
 fmt.Println(deleteEditingProjectsResult, err)


 // 搜索云剪辑工程
 maxResults := 10
 searchEditingProjectRequest := ice.SearchEditingProjectRequest{
  MaxResults: &maxResults,
 }
 searchEditingProjectResult, err := iceClient.SearchEditingProject(&searchEditingProjectRequest)
 fmt.Println(searchEditingProjectResult, err)

}

func InitICEClient(accessKeyId string, accessKeySecret string) (client *ice.Client, err error) {

 // ICE接入区域
 regionId := "cn-shanghai"

 // ICE EndPoint
 endPoint := "ice.cn-shanghai.aliyuncs.com"

 config := new(client2.Config)
 config.SetAccessKeyId(accessKeyId).
  SetAccessKeySecret(accessKeySecret).
  SetRegionId(regionId).
  SetEndpoint(endPoint)


 // 创建ICEClient实例
 return ice.NewClient(config)
}