全部产品
云市场

视频AI

更新时间:2019-01-24 15:39:42

初始化客户端

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

提交AI作业

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

  1. function submitAIJob($client) {
  2. $request = new vod\SubmitAIJobRequest();
  3. // 设置视频ID
  4. $request->setMediaId('04df94402a5342928de6d6a26xxxxxxx');
  5. // 设置AI类型,请确保已开通该类型AI
  6. $request->setTypes('AIVideoCover');
  7. // 返回结果
  8. return $client->getAcsResponse($request);
  9. }
  10. try {
  11. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  12. $result = submitAIJob($client);
  13. var_dump($result);
  14. } catch (Exception $e) {
  15. print $e->getMessage()."\n";
  16. }

查询AI作业

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

  1. function listAIJob($client) {
  2. $request = new vod\ListAIJobRequest();
  3. // 设置作业ID
  4. $request->setJobIds("7664bb4f06c44f0a84ccb49f4xxxxxx,1234b4f06c44f0a84ccb49f4xxxxxx");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = listAIJob($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }

添加AI模板

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

  1. function addAITemplate($client) {
  2. $request = new vod\AddAITemplateRequest();
  3. // 设置模板类型,以智能审核模板为例
  4. $request->setTemplateType("AIMediaAudit");
  5. // 设置模板名称
  6. $request->setTemplateName("myaitemplate");
  7. // 设置模板详细配置
  8. $templateConfigrray = array();
  9. $auditItem = array();
  10. $auditItem[] = "terrorism";
  11. $auditItem[] = "porn";
  12. $templateConfig["AuditItem"] = $auditItem;
  13. $auditRange = array();
  14. $auditRange[] = "video";
  15. $auditRange[] = "image-cover";
  16. $auditRange[] = "text-title";
  17. $templateConfig["AuditRange"] = $auditRange;
  18. $auditContent = array();
  19. $auditContent[] = "screen";
  20. $templateConfig["AuditContent"] = $auditContent;
  21. $templateConfig["AuditAutoBlock"] = "no";
  22. $request->setTemplateConfig(json_encode($templateConfig));
  23. // 返回结果
  24. return $client->getAcsResponse($request);
  25. }
  26. try {
  27. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  28. $result = addAITemplate($client);
  29. var_dump($result);
  30. } catch (Exception $e) {
  31. print $e->getMessage()."\n";
  32. }

删除AI模板

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

  1. function deleteAITemplate($client) {
  2. $request = new vod\DeleteAITemplateRequest();
  3. // 设置模板ID
  4. $request->setTemplateId("3e539dfefc651c6796fea2549axxxx");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = deleteAITemplate($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }

修改AI模板

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

  1. function updateAITemplate($client) {
  2. $request = new vod\UpdateAITemplateRequest();
  3. // 设置模板ID
  4. $request->setTemplateId("3e539dfefc651c6796fea2549axxxx");
  5. // 设置模板名称
  6. $request->setTemplateName("myaitempalte1");
  7. // 设置模板详细配置
  8. $templateConfigrray = array();
  9. $auditItem = array();
  10. $auditItem[] = "terrorism";
  11. //$auditItem[] = "porn";
  12. $templateConfig["AuditItem"] = $auditItem;
  13. $auditRange = array();
  14. $auditRange[] = "video";
  15. $auditRange[] = "image-cover";
  16. //$auditRange[] = "text-title";
  17. $templateConfig["AuditRange"] = $auditRange;
  18. $auditContent = array();
  19. $auditContent[] = "screen";
  20. $templateConfig["AuditContent"] = $auditContent;
  21. $templateConfig["AuditAutoBlock"] = "no";
  22. $request->setTemplateConfig(json_encode($templateConfig));
  23. // 返回结果
  24. return $client->getAcsResponse($request);
  25. }
  26. try {
  27. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  28. $result = updateAITemplate($client);
  29. var_dump($result);
  30. } catch (Exception $e) {
  31. print $e->getMessage()."\n";
  32. }

查询AI模板

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

  1. function getAITemplate($client) {
  2. $request = new vod\GetAITemplateRequest();
  3. // 设置模板ID
  4. $request->setTemplateId("3e539dfefc651c6796fea2549axxxx");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = getAITemplate($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }

查询AI模板列表

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

  1. function listAITemplate($client) {
  2. $request = new vod\ListAITemplateRequest();
  3. // 设置模板类型,以智能审核模板为例
  4. $request->setTemplateType("AIMediaAudit");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = listAITemplate($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }

设置默认AI模板

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

  1. function setDefaultAITemplate($client) {
  2. $request = new vod\SetDefaultAITemplateRequest();
  3. // 设置模板ID
  4. $request->setTemplateId("3e539dfefc651c6796fea2549axxxx");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = setDefaultAITemplate($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }

查询默认AI模板

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

  1. function getDefaultAITemplate($client) {
  2. $request = new vod\GetDefaultAITemplateRequest();
  3. // 设置模板类型,以智能审核模板为例
  4. $request->setTemplateType("AIMediaAudit");
  5. // 返回结果
  6. return $client->getAcsResponse($request);
  7. }
  8. try {
  9. $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
  10. $result = getDefaultAITemplate($client);
  11. var_dump($result);
  12. } catch (Exception $e) {
  13. print $e->getMessage()."\n";
  14. }