The operation of exporting videos consists of exporting video configurations as well as producing and uploading videos. This topic describes how to export videos.

Supported editions

Edition Supported
Professional Yes
Standard Yes
Basic Yes

Related classes

Class Description
AliyunVideoParam A class that defines the parameters for video production and export.
AliyunIVodCompose A class that defines video production and upload features, such as video initialization and production, video upload, and upload credentials update.
AliyunComposeFactory A factory class that is used to create production instances.

Procedure of video export

Step Description Sample code
1 Export the configurations of the current video. Export video configurations
2 Produce the video. You can set the pause, resume, and cancel features. Produce the video
3 Upload the video. You can set the pause, continue, and cancel features. Upload the video
4 Release resources. Release resources.
Note
  • The production API operation must be called before the upload API operation.
  • The production API operation can be called multiple times. The upload API operation uploads only the latest video that is produced.
  • If a video is edited, you must save the effects that are added to the video to the on-premises configuration file before you create an AliyunIVodCompose instance. Otherwise, the produced video does not contain these effects. To save added effects to the on-premises configuration file, call the following API operation:
    AliyunIEditor.saveEffectToLocal();

Export video configurations

In this step, the configurations of the current video are exported. The final video file is not produced and exported.

For more information about operation parameters, see AliyunVideoParam.

// Export the video configurations and generate the configuration file of outputPath.
AliyunIEditor.compose(AliyunVideoParam param, String outputPath, AliyunIComposeCallBack callback);

// Cancel the export of the video configurations.
AliyunIEditor.cancelCompose();

Produce the video

The short video SDK provides a set of API operations to implement the video production and upload features. You can use the AliyunIVodCompose core class to produce and upload edited videos on a dedicated user interface (UI). The production API operation can be called multiple times.

For more information about operation parameters, see AliyunIVodCompose and AliyunComposeFactory.

Initialize and produce the instance to be uploaded.
// Create an instance.
AliyunComposeFactory.createAliyunVodCompose();

// Initialize the instance.
AliyunIVodCompose.init(Context context);
Produce the instance.
AliyunIVodCompose.compose(String config, String output, AliyunIComposeCallBack callback);
Control the video production as needed.
// Pause the production.
AliyunIVodCompose.pauseCompose();
// Resume the production.
AliyunIVodCompose.resumeCompose();
// Cancel the production.
AliyunIVodCompose.cancelCompose();

Upload the video

After the video is produced, call the upload API operation to upload the video. The upload API operation uploads only the latest video that is produced.

For more information about operation parameters, see AliyunIVodCompose and AliyunComposeFactory.

Upload the video.

  • Obtain the upload address and credentials.

    You can use the AliyunIVodCompose class to upload the video based on the upload address and credentials. Before you upload the video, obtain the upload address and credentials. For more information, see CreateUploadVideo.

  • Upload the video file to an OSS bucket.
    // Upload the video by using the upload address and credentials.
    // videoPath: the path to the video file.
    // uploadAddress: the upload address.
    // uploadAuth: the upload credentials.
    // aliyunVodUploadCallBack: the upload callback.
    // Upload the video.
    AliyunIVodCompose.uploadVideoWithVod(String videoPath, String uploadAddress, String uploadAuth, AliyunIVodUploadCallBack aliyunVodUploadCallBack);
  • Refresh the upload credentials.

    Upload credentials have a valid term. After the video is uploaded, you must call onUploadTokenExpired to re-obtain the upload credentials and then use AliyunIVodCompose.refreshWithUploadAuth(String uploadAuth) to refresh the upload credentials. For more information, see RefreshUploadVideo.

Control the video upload as needed.
// Pause the upload.
AliyunIVodCompose.pauseUpload();
// Continue the upload.
AliyunIVodCompose.resumeUpload();
// Cancel the upload.
AliyunIVodCompose.cancelUpload();

Release resources.

After the video is uploaded, destroy the instance and release the resources.
AliyunIVodCompose.release();