全部产品
云市场

视频AI

更新时间:2019-01-24 15:40:00

初始化客户端

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

提交AI作业

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 提交作业
  8. */
  9. VodApiResponse submitAIJob(VodCredential authInfo) {
  10. string apiName = "SubmitAIJob";
  11. map<string, string> args;
  12. // 设置视频ID
  13. args["MediaId"] = "3eb19a4585bc475e995bddxxxxxxxx";
  14. // 设置AI类型,请确保已开通该类型AI
  15. args["Types"] = "AIVideoCover";
  16. return getAcsResponse(authInfo, apiName, args);
  17. }
  18. // 请求示例
  19. void main() {
  20. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  21. VodApiResponse response = submitAIJob(authInfo);
  22. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  23. }

查询AI作业

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 查询作业
  8. */
  9. VodApiResponse listAIJob(VodCredential authInfo) {
  10. string apiName = "ListAIJob";
  11. map<string, string> args;
  12. // 设置作业ID
  13. args["JobIds"] = "979d4d7a36ae41b1a945a2xxxxx,3eb19a4585bc475e995bddeaxxxxx";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = listAIJob(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

添加AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 添加AI模板
  8. */
  9. VodApiResponse addAITemplate(VodCredential authInfo) {
  10. string apiName = "AddAITemplate";
  11. map<string, string> args;
  12. // 设置模板类型,以智能审核模板为例
  13. args["TemplateType"] = "AIMediaAudit";
  14. // 设置模板名称
  15. args["TemplateName"] = "我的自定义模板";
  16. // 设置模板详细配置
  17. Json::Value templateConfig;
  18. Json::Value auditItem;
  19. auditItem.append("terrorism");
  20. auditItem.append("porn");
  21. templateConfig["AuditItem"] = auditItem;
  22. Json::Value auditRange;
  23. auditRange.append("video");
  24. auditRange.append("image-cover");
  25. auditRange.append("text-title");
  26. templateConfig["AuditRange"] = auditRange;
  27. Json::Value auditContent;
  28. auditContent.append("screen");
  29. templateConfig["AuditContent"] = auditContent;
  30. templateConfig["AuditAutoBlock"] = "no";
  31. args["TemplateConfig"] = templateConfig.toStyledString();
  32. return getAcsResponse(authInfo, apiName, args);
  33. }
  34. // 请求示例
  35. void main() {
  36. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  37. VodApiResponse response = addAITemplate(authInfo);
  38. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  39. }

删除AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 删除AI模板
  8. */
  9. VodApiResponse deleteAITemplate(VodCredential authInfo) {
  10. string apiName = "DeleteAITemplate";
  11. map<string, string> args;
  12. // 设置模板ID
  13. args["TemplateId"] = "1d763dd8987a122ab8596eb7d2c8f1e6";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = deleteAITemplate(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

修改AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 修改AI模板
  8. */
  9. VodApiResponse updateAITemplate(VodCredential authInfo) {
  10. string apiName = "UpdateAITemplate";
  11. map<string, string> args;
  12. // 设置模板ID
  13. args["TemplateId"] = "1d763dd8987a122ab8596eb7d2xxxxxx";
  14. // 设置模板名称
  15. args["TemplateName"] = "我的自定义模板";
  16. // 设置模板详细配置
  17. Json::Value templateConfig;
  18. Json::Value auditItem;
  19. auditItem.append("terrorism");
  20. auditItem.append("porn");
  21. templateConfig["AuditItem"] = auditItem;
  22. Json::Value auditRange;
  23. auditRange.append("video");
  24. auditRange.append("image-cover");
  25. auditRange.append("text-title");
  26. templateConfig["AuditRange"] = auditRange;
  27. Json::Value auditContent;
  28. auditContent.append("screen");
  29. templateConfig["AuditContent"] = auditContent;
  30. templateConfig["AuditAutoBlock"] = "no";
  31. args["TemplateConfig"] = templateConfig.toStyledString();
  32. return getAcsResponse(authInfo, apiName, args);
  33. }
  34. // 请求示例
  35. void main() {
  36. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  37. VodApiResponse response = updateAITemplate(authInfo);
  38. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  39. }

查询AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 查询AI模板
  8. */
  9. VodApiResponse getAITemplate(VodCredential authInfo) {
  10. string apiName = "GetAITemplate";
  11. map<string, string> args;
  12. // 设置模板ID
  13. args["TemplateId"] = "1d763dd8987a122ab8596eb7d2c8f1e6";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = getAITemplate(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

查询AI模板列表

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 查询AI模板列表
  8. */
  9. VodApiResponse listAITemplate(VodCredential authInfo) {
  10. string apiName = "ListAITemplate";
  11. map<string, string> args;
  12. // 设置模板类型,以智能审核模板为例
  13. args["TemplateType"] = "AIMediaAudit";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = listAITemplate(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

设置默认AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 设置默认AI模板
  8. */
  9. VodApiResponse setDefaultAITemplate(VodCredential authInfo) {
  10. string apiName = "SetDefaultAITemplate";
  11. map<string, string> args;
  12. // 设置模板ID
  13. args["TemplateId"] = "1d763dd8987a122ab8596eb7d2c8f1e6";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = setDefaultAITemplate(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

查询默认AI模板

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include <jsoncpp/json/json.h>
  5. #include "vod_sdk/openApiUtil.h"
  6. /**
  7. * 查询默认AI模板
  8. */
  9. VodApiResponse getDefaultAITemplate(VodCredential authInfo) {
  10. string apiName = "GetDefaultAITemplate";
  11. map<string, string> args;
  12. // 设置模板类型,以智能审核模板为例
  13. args["TemplateType"] = "AIMediaAudit";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = getDefaultAITemplate(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }