全部产品
云市场

视频DNA

更新时间:2018-12-30 10:15:03

初始化客户端

使用前请先初始化客户端,参考 initVodClient 接口。

提交视频DNA作业

接口参数和返回字段请参考 SubmitAIJob

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("SubmitAIJob", {
  4. MediaId: '11114b934f074a1aa20317eca67xxxxx',
  5. Types: 'AIMediaDNA'
  6. }, {}).then(function (response) {
  7. if (response.AIJobList && response.AIJobList.AIJob && response.AIJobList.AIJob.length > 0){
  8. for(var i=0; i<response.AIJobList.AIJob.length; i++){
  9. var job = response.AIJobList.AIJob[i];
  10. // 视频ID
  11. console.log('MediaId = ' + job.MediaId);
  12. // 作业ID
  13. console.log('JobId = ' + job.JobId);
  14. // AI类型
  15. console.log('Type = ' + job.Type);
  16. }
  17. }
  18. console.log('RequestId = ' + response.RequestId);
  19. }).catch(function (response) {
  20. console.log('ErrorCode = ' + response.data.Code);
  21. console.log('ErrorMessage = ' + response.data.Message);
  22. console.log('RequestId = ' + response.data.RequestId);
  23. });

查询视频DNA作业

接口参数和返回字段请参考 ListAIJob

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("ListAIJob", {
  4. JobIds: 'JobId1,JobId2'
  5. }, {}).then(function (response) {
  6. // 打印作业列表
  7. console.log("============ AIJobList ============");
  8. if (response.AIJobList && response.AIJobList.AIJob && response.AIJobList.AIJob.length > 0){
  9. for(var i=0; i<response.AIJobList.AIJob.length; i++){
  10. var job = response.AIJobList.AIJob[i];
  11. // 视频ID
  12. console.log('MediaId = ' + job.MediaId);
  13. // 作业ID
  14. console.log('JobId = ' + job.JobId);
  15. // AI类型,注意校验类型是否为AIMediaDNA
  16. console.log('Type = ' + job.Type);
  17. // 作业状态
  18. console.log('Status = ' + job.Status);
  19. // 作业结果
  20. console.log('Data = ' + job.Data);
  21. }
  22. }
  23. // 打印不存在的作业ID
  24. console.log("============ NonExistAIJobIds ============");
  25. if (response.NonExistAIJobIds && response.NonExistAIJobIds.String && response.NonExistAIJobIds.String.length > 0) {
  26. for (var i=0; i<response.NonExistAIJobIds.String.length; i++) {
  27. // 作业ID
  28. console.log('NonExistAIJobId = ' + response.NonExistAIJobIds.String[i]);
  29. }
  30. }
  31. console.log('RequestId = ' + response.RequestId);
  32. }).catch(function (response) {
  33. console.log('ErrorCode = ' + response.data.Code);
  34. console.log('ErrorMessage = ' + response.data.Message);
  35. console.log('RequestId = ' + response.data.RequestId);
  36. });

获取视频DNA结果

接口参数和返回字段请参考 GetMediaDNAResult

  1. // 调用样例
  2. var client = initVodClient('<Your AccessKeyId>','<Your AccessKeySecret>');
  3. client.request("GetMediaDNAResult", {
  4. MediaId: '3eb19a4585bc475e995bddxxxxxxxx'
  5. }, {}).then(function (response) {
  6. // 打印DNA结果
  7. console.log("DNAResult = ");
  8. console.log(response.DNAResult);
  9. console.log('RequestId = ' + response.RequestId);
  10. }).catch(function (response) {
  11. console.log('ErrorCode = ' + response.data.Code);
  12. console.log('ErrorMessage = ' + response.data.Message);
  13. console.log('RequestId = ' + response.data.RequestId);
  14. });