简介
本文档提供关于提交一个人声分离任务的相关 API 概览以及 SDK 示例代码。
API | 操作描述 |
提交一个人声分离任务 |
SDK API 参考
提交任务
功能说明
提交一个人声分离任务
注意:
COS Android SDK 版本需要大于等于 v5.9.32。
示例代码
// 存储桶名称,格式为 BucketName-APPIDString bucket = "examplebucket-1250000000";SubmitVoiceSeparateJobRequest request = new SubmitVoiceSeparateJobRequest(bucket);SubmitVoiceSeparateJob submitVoiceSeparateJob = new SubmitVoiceSeparateJob();SubmitVoiceSeparateJob.SubmitVoiceSeparateJobInput input = new SubmitVoiceSeparateJob.SubmitVoiceSeparateJobInput();// 设置文件路径;是否必传:是input.object = "input/demo.mp4";submitVoiceSeparateJob.input = input;SubmitVoiceSeparateJob.SubmitVoiceSeparateJobOutput output = new SubmitVoiceSeparateJob.SubmitVoiceSeparateJobOutput();// 设置存储桶的地域;是否必传:是output.region = "ap-chongqing";// 设置存储结果的存储桶;是否必传:是output.bucket = "test-123456789";// 设置背景音结果文件名;是否必传:否output.object = "output/backgroud.${ext}";// 设置人声结果文件名;是否必传:否output.auObject = "output/audio.${ext}";SubmitVoiceSeparateJob.SubmitVoiceSeparateJobOperation operation = new SubmitVoiceSeparateJob.SubmitVoiceSeparateJobOperation();operation.output = output;// 设置任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0;是否必传:否operation.jobLevel = "0";// 设置人声分离模板 ID;是否必传:否operation.templateId = "t1460606b9752148c4ab182f55163ba7cd";submitVoiceSeparateJob.operation = operation;// 设置任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式;是否必传:否submitVoiceSeparateJob.callBackFormat = "XML";submitVoiceSeparateJob.callBackType = "Url";// 设置任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调;是否必传:否submitVoiceSeparateJob.callBack = "http://callback.demo.com";request.setSubmitVoiceSeparateJob(submitVoiceSeparateJob);ciService.submitVoiceSeparateJobAsync(request, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest request, CosXmlResult cosResult) {// result 提交任务的结果// 详细字段请查看api文档或者SDK源码SubmitVoiceSeparateJobResult result = (SubmitVoiceSeparateJobResult) cosResult;}@Overridepublic void onFail(CosXmlRequest request, CosXmlClientException clientException, CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
说明: