Video editing and production
Updated at:
By reading this article, you can learn the sample code for creating an intelligent media service clip composition task by calling the OpenAPI of the server SDK.
Sample code
Debug this API operation online in 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 AccessKey of an Alibaba Cloud account has all API access permissions. Use a Resource Access Management (RAM) user to call API operations or perform routine O&M.
// This example shows how to store an AccessKey ID and an AccessKey secret in environment variables. For more information about the configuration, refer to the Alibaba Cloud documentation on AccessKey management.
const cred = new Credential();
const iceClient = new Client(new $OpenApi.Config({
credential: cred,
endpoint: 'ice.cn-shanghai.aliyuncs.com'
}));
// The following code shows how to hard-code an AccessKey ID and an AccessKey secret. Do not store your AccessKey ID and AccessKey secret in your project code. Storing them in your code can cause an AccessKey leak and threaten 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 a production job using a timeline.
iceClient.submitMediaProducingJob({
Timeline: "{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"9b4d7cf14dc7b83b0e801cbe****\"},{\"MediaId\":\"b4d7cf14dc7b83b0e801cbe****\"}]}]}",
ProduceTarget: "{\"mediaURL\":\"http://ice-editing.oss-cn-hangzhou.aliyuncs.com/ice/\"}",
ProjectMetadata: "{\"coverURL\":\"http://test.testvod123.com/media/cover/mediaid.jpg\",\"description\":\"description\",\"title\":\"title\",\"tags\":\"Tag1,Tag2,Test\"}"
}).then(function (data) {
console.log(data.body);
}, function (err) {
console.log('Error:' + err);
});
// Create a production job using a template.
iceClient.submitMediaProducingJob({
TemplateId : "IceSys_VideoMerge",
ClipsParam : "{\"VideoArray\":[\"s05512043f49f697f7425as****\",\"s2788e810116a45109f2efd****\",\"sd67f44f4964e6c998dee8df****\",]}",
ProduceTarget : "{\"mediaURL\":\"http://ice-editing.oss-cn-hangzhou.aliyuncs.com/ice/\"}"
}).then(function (data) {
console.log(data.body);
}, function (err) {
console.log('Error:' + err);
});
// Create a production job using a project.
iceClient.submitMediaProducingJob({
ProjectId : "****9b4d7cf14dc7b83b0e801cbe****",
ProduceTarget : "{\"mediaURL\":\"http://ice-editing.oss-cn-hangzhou.aliyuncs.com/ice/\"}",
}).then(function (data) {
console.log(data.body);
}, function (err) {
console.log('Error:' + err);
});
// Query a video editing and production job.
iceClient.getMediaProducingJob({
JobId: "9b4d7cf14dc7b83b0e801cbe****"
}).then(function (data) {
console.log(data.body);
}, function (err) {
console.log('Error:' + err);
});
Related API operations
SubmitMediaProducingJob - Submits a video editing and production job.
GetMediaProducingJob - Queries a video editing and production job.
Is this page helpful?