Manage online editing projects

更新时间:
复制 MD 格式

Sample code for managing online editing projects in Intelligent Media Services by calling OpenAPI operations through a server-side SDK.

Sample code

You can perform online debugging on the Alibaba Cloud OpenAPI Developer Portal.

import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import Credential, { Config } from '@alicloud/credentials';
const Client = require('@alicloud/ice20201109').default;

// An Alibaba Cloud account AccessKey has access permissions for all APIs. Use a Resource Access Management (RAM) user for API access or daily O&M.
// This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For configuration instructions, see: https://help.aliyun.com/document_detail/378664.html

const cred = new Credential();
const iceClient = new Client(new $OpenApi.Config({
  credential: cred,
  endpoint: 'ice.cn-shanghai.aliyuncs.com'
}));

// To hard-code the AccessKey ID and AccessKey secret, use the following code. However, do not save the AccessKey ID and AccessKey secret in your project code. This can cause an AccessKey leak and compromise the security of all resources in your account.
// const iceClient = new Client(new $OpenApi.Config({
//   accessKeyId: '<yourAccessKeyId>',
//   accessKeySecret: '<yourAccessKeySecret>',
//   endpoint: 'ice.cn-shanghai.aliyuncs.com'
// }));

// Create an online editing project
iceClient.createEditingProject({
    Title: "TestProjectName",
    Description: "TestProjectDescription",
    Timeline: "{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"****9b4d7cf14dc7b83b0e801cbe****\"}]}]}",
    CoverUrl: "http://xxxx/coverUrl.jpg"
}).then(function (data) {
  console.log(data.body);
}, function (err) {
  console.log('Error:' + err);
});

// Get a single online editing project
iceClient.getEditingProject({
    ProjectId: "42221ca594154d2fafa2842ecb85****"
}).then(function (data) {
  console.log(data.body);
}, function (err) {
  console.log('Error:' + err);
});

// Update an online editing project
iceClient.updateEditingProject({
    ProjectId: "42221ca594154d2fafa2842ecb85****",
    Timeline: "{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"9b4d7cf14dc7b83b0e801cbe****\"},]}]}"
}).then(function (data) {
  console.log(data.body);
}, function (err) {
  console.log('Error:' + err);
});

// Delete online editing projects
iceClient.deleteEditingProjects({
    ProjectId: "42221ca594154d2fafa2842ecb85****"
}).then(function (data) {
  console.log(data.body);
}, function (err) {
  console.log('Error:' + err);
});

// Search for online editing projects
iceClient.deleteEditingProjects({
    ProjectId: "42221ca594154d2fafa2842ecb85****"
}).then(function (data) {
  console.log(data.body);
}, function (err) {
  console.log('Error:' + err);
});

Related APIs