This topic describes how to export videos using the short video SDK for iOS.
Supported editions
Edition | Supported |
Professional Edition | Supported |
Standard Edition | Support |
Basic Edition | No |
Related classes
Name | Features |
The export protocol that is used to obtain the export controller, configure export parameters, and start exporting videos. | |
The export status callback protocol that is used to set callbacks such as the export completion callback, export progress callback, and export failure callback. | |
The class that is used to set video parameters, such as the encoding type and frame rate of the video that you want to export. |
Export control
Initialize the AliyunIExporter class to obtain the export controller, configure the export parameters, and start the video export.
For more information about the parameters, see AliyunIExporter and AliyunVideoParam.
// Obtain the export controller.
id<AliyunIExporter> exporter = [editor getExporter];
// Configure export parameters.
AliyunVideoParam *param = [[AliyunVideoParam alloc] init];
param.fps = 60;
param.gop = 250;
param.videoQuality = AliyunVideoQualityHight;
// ... For information about other export properties, see the API reference.
[exporter setVideoParam:param];
// Set the output video watermark.
AliyunEffectImage *watermark = [[AliyunEffectImage alloc] initWithFile:watermarkPath];
watermarkPath.frame = CGRectMake(10, 10, 50, 50);
// .. For information about other properties, see the API reference.
[exporter setWaterMark:watermark];
// Set the end watermark.
AliyunEffectImage *tailWatermark = [[AliyunEffectImage alloc] initWithFile:watermarkPath];
tailWatermark.frame = CGRectMake(10, 10, 50, 50);
tailWatermark.endTime = 2;
// .. For information about other properties, see the API reference.
[exporter setTailWaterMark:tailWatermark];
// Start the export.
[exporter startExport:outputPath];
// Pause the export.
[exporter pauseExport];
// Resume the export.
[exporter resumeExport]
// Cancel the export.
[exporter cancelExport];Set callbacks
You can set callbacks to obtain the export progress and status of videos. For more information about the parameters, see AliyunIExporterCallback.
// Set callbacks for the export status.
editor.exporterCallback = self;
// Status protocol: AliyunIExporterCallback
- (void)exporterDidEnd:(NSString *)outputPath {
// The callback for the end of the export.
}
- (void)exporterDidCancel {
// The callback for the cancellation of the export.
}
- (void)exportProgress:(float)progress {
// The callback for the export progress.
}
- (void)exportError:(int)errorCode {
// The callback for the export error.
}