全部产品

云剪辑工程管理

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

云剪辑工程管理

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

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

搜索云剪辑工程

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

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

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

详见 搜索云剪辑工程 API。

代码示例

package com.aliyun.ice.sample;

import com.aliyun.ice20201109.models.*;
import com.aliyun.teaopenapi.models.*;
import com.aliyun.ice20201109.Client;

/**
 * @author :xxxxx
 * @date :Created in 2021/1/12
 */
public class EditingProjectSample {

    public static void main (String args[]) {
        try {
            // 初始化SDK
            Config config = new Config();
            config.accessKeyId = "<yourAccessKeyId>";
            config.accessKeySecret = "<yourAccessKeySecret>";
            config.endpoint = "ice.cn-shanghai.aliyuncs.com";
            config.regionId = "cn-shanghai";
            Client iceClient = new Client(config);

            // 搜搜云剪辑工程
            SearchEditingProjectRequest searchEditingProjectRequest = new SearchEditingProjectRequest();
            SearchEditingProjectResponse searchEditingProjectResponse = iceClient.searchEditingProject(searchEditingProjectRequest);

            System.out.println("totle count : " + searchEditingProjectResponse.getBody().getTotalCount());
            System.out.println("next token : " + searchEditingProjectResponse.getBody().getNextToken());
            System.out.println("size : " + searchEditingProjectResponse.getBody().getProjectList().size());
            if (searchEditingProjectResponse.getBody().getProjectList().size() > 0) {
                System.out.println("projectid : " + searchEditingProjectResponse.getBody().getProjectList().get(0).getProjectId());
                System.out.println("title : " + searchEditingProjectResponse.getBody().getProjectList().get(0).getTitle());
                System.out.println("maxresult : " + searchEditingProjectResponse.getBody().getMaxResults());
            }

            // 创建云剪辑工程
            CreateEditingProjectRequest createEditingProjectRequest = new CreateEditingProjectRequest();
            createEditingProjectRequest.setTitle("测试工程名字");
            createEditingProjectRequest.setDescription("测试工程描述");
            createEditingProjectRequest.setTimeline("{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"}]}]}");
            createEditingProjectRequest.setCoverURL("http://xxxx/coverUrl.jpg");
            CreateEditingProjectResponse createEditingProjectResponse = iceClient.createEditingProject(createEditingProjectRequest);
            String projectId = createEditingProjectResponse.getBody().getProject().getProjectId();
            System.out.println("project id : " + projectId);

            // 获取单个云剪辑工程
            GetEditingProjectRequest getEditingProjectRequest = new GetEditingProjectRequest();
            getEditingProjectRequest.setProjectId(projectId);
            GetEditingProjectResponse getEditingProjectResponse = iceClient.getEditingProject(getEditingProjectRequest);
            GetEditingProjectResponseBody.GetEditingProjectResponseBodyProject project = getEditingProjectResponse.getBody().getProject();
            System.out.println("project id : " + project.getProjectId());

            // 修改云剪辑工程
            UpdateEditingProjectRequest updateEditingProjectRequest = new UpdateEditingProjectRequest();
            updateEditingProjectRequest.setProjectId("11119b4d7cf14dc7b83b0e801cbe1ce6");
            updateEditingProjectRequest.setTimeline("{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"}]}]}");
            UpdateEditingProjectResponse updateEditingProjectResponse = iceClient.updateEditingProject(updateEditingProjectRequest);
            System.out.println("request id : " + updateEditingProjectResponse.getBody().getRequestId());

            // 删除云剪辑工程
            DeleteEditingProjectsRequest deleteEditingProjectsRequest = new DeleteEditingProjectsRequest();
            deleteEditingProjectsRequest.setProjectIds("****9b4d7cf14dc7b83b0e801cbe****,****9b4d7cf14dc7b83b0e801cbe****");
            iceClient.deleteEditingProjects(deleteEditingProjectsRequest);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}