简介
本文档提供关于音乐评分的相关 API 概览以及 SDK 示例代码。
API | 操作描述 |
提交一个音乐评分任务 |
SDK API 参考
提交任务
功能说明
提交一个音乐评分任务。
注意:
COS Android SDK 版本需要大于等于 v5.9.32。
示例代码
// 存储桶名称,格式为 BucketName-APPIDString bucket = "examplebucket-1250000000";VocalScoreRequest request = new VocalScoreRequest(bucket);VocalScore vocalScore = new VocalScore();// 提交任务请求体request.setVocalScore(vocalScore);// 设置请求VocalScore.VocalScoreInput vocalScoreInput = new VocalScore.VocalScoreInput();vocalScore.input = vocalScoreInput;// 设置文件路径;是否必传:否vocalScoreInput.object = "input/test.mp3";VocalScore.VocalScoreOperation vocalScoreOperation = new VocalScore.VocalScoreOperation();vocalScore.operation = vocalScoreOperation;VocalScore.VocalScoreVocalScore vocalScoreVocalScore = new VocalScore.VocalScoreVocalScore();vocalScoreOperation.vocalScore = vocalScoreVocalScore;// 设置比对基准文件路径;是否必传:否vocalScoreVocalScore.standardObject = "input/base.mp3";// 设置透传用户信息, 可打印的 ASCII 码, 长度不超过1024;是否必传:否vocalScoreOperation.userData = "This is my data.";// 设置任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0;是否必传:否vocalScoreOperation.jobLevel = "0";// 设置任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式;是否必传:否vocalScore.callBackFormat = "JSON";// 设置任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调;是否必传:否vocalScore.callBack = "http://callback.demo.com";ciService.vocalScoreAsync(request, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest request, CosXmlResult cosResult) {// result 提交任务的结果// 详细字段请查看api文档或者SDK源码VocalScoreResult result = (VocalScoreResult) cosResult;}@Overridepublic void onFail(CosXmlRequest request, CosXmlClientException clientException, CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
说明: