简介
本文档提供关于提交精彩集锦任务相关的 API 概览以及 SDK 示例代码。
API | 操作描述 |
提交精彩集锦任务 |
SDK API 参考
提交精彩集锦任务
功能说明
提交精彩集锦任务。
注意
COS Android SDK 版本需要大于等于 v5.9.14。
示例代码
// 存储桶名称,格式为 BucketName-APPIDString bucket = "examplebucket-1250000000";// 对象键,是对象在 COS 上的完整路径,如果带目录的话,格式为 "dir1/object1"String object = "dir1/exampleobject.mp4";// 输出路径文件夹String outputResultPath = "media/job_result/";SubmitVideoMontageJobRequest request = new SubmitVideoMontageJobRequest(bucket);SubmitVideoMontageJob submitVideoMontageJob = new SubmitVideoMontageJob();SubmitVideoMontageJob.SubmitVideoMontageJobInput input = new SubmitVideoMontageJob.SubmitVideoMontageJobInput();// 文件路径input.object = object;submitVideoMontageJob.input = input;SubmitVideoMontageJob.SubmitVideoMontageJobOutput output = new SubmitVideoMontageJob.SubmitVideoMontageJobOutput();// 输出存储桶地域output.region = "ap-guangzhou";// 输出存储桶output.bucket = bucket;// 输出结果的文件名。output.object = outputResultPath+"video_montage.${ext}";// 操作配置SubmitVideoMontageJob.SubmitVideoMontageJobOperation operation = new SubmitVideoMontageJob.SubmitVideoMontageJobOperation();operation.output = output;SubmitVideoMontageJob.SubmitVideoMontageJobVideoMontage videoMontage = new SubmitVideoMontageJob.SubmitVideoMontageJobVideoMontage();TemplateVideoMontage.TemplateVideoMontageContainer container = new TemplateVideoMontage.TemplateVideoMontageContainer();// 封装格式: mp4、flv、hls、ts、mkv;是否必传:是;container.format = "mp4";videoMontage.container = container;operation.videoMontage = videoMontage;// 任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0;是否必传:否;operation.jobLevel = "0";submitVideoMontageJob.operation = operation;// 任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式;是否必传:否;submitVideoMontageJob.callBackFormat = "XML";// 任务回调类型,Url 或 TDMQ,默认 Url,优先级高于队列的回调类型;是否必传:否;submitVideoMontageJob.callBackType = "Url";// 任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调;是否必传:否;submitVideoMontageJob.callBack = "http://callback.demo.com";request.setSubmitVideoMontageJob(submitVideoMontageJob);// 更多配置请查看api文档或者SDK源码ciService.submitVideoMontageJobAsync(request, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest request, CosXmlResult cosResult) {// result 提交精彩集锦任务的结果// 详细字段请查看api文档或者SDK源码SubmitVideoMontageJobResult result = (SubmitVideoMontageJobResult) cosResult;}@Overridepublic void onFail(CosXmlRequest request, CosXmlClientException clientException, CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
说明