全部产品
云市场

媒资管理

更新时间:2018-12-30 17:22:42

初始化客户端

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

搜索媒资信息

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 搜索媒资信息
  7. */
  8. VodApiResponse searchMedia(VodCredential authInfo) {
  9. string apiName = "SearchMedia";
  10. map<string, string> args;
  11. args["Fields"] = "Title,CoverURL,Status";
  12. args["Match"] = "Status in ('Normal','Checking') and CreationTime = ('2018-07-01T08:00:00Z','2018-08-01T08:00:00Z')";
  13. args["PageNo"] = "1";
  14. args["PageSize"] = "10";
  15. args["SearchType"] = "video";
  16. args["SortBy"] = "CreationTime:Desc";
  17. return getAcsResponse(authInfo, apiName, args);
  18. }
  19. // 请求示例
  20. void main() {
  21. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  22. VodApiResponse response = searchMedia(authInfo);
  23. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  24. }

获取视频信息

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 获取视频信息
  7. */
  8. VodApiResponse getVideoInfo(VodCredential authInfo) {
  9. string apiName = "GetVideoInfo";
  10. map<string, string> args;
  11. args["VideoId"] = "<VideoId>";
  12. return getAcsResponse(authInfo, apiName, args);
  13. }
  14. // 请求示例
  15. void main() {
  16. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  17. VodApiResponse response = getVideoInfo(authInfo);
  18. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  19. }

批量获取视频信息

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 批量获取视频信息函数
  7. */
  8. VodApiResponse getVideoInfos(VodCredential authInfo) {
  9. string apiName = "GetVideoInfos";
  10. map<string, string> args;
  11. args["VideoIds"] = "VideoId1,VideoId2";
  12. return getAcsResponse(authInfo, apiName, args);
  13. }
  14. // 请求示例
  15. void main() {
  16. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  17. VodApiResponse response = getVideoInfos(authInfo);
  18. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  19. }

修改视频信息

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 修改视频信息
  7. */
  8. VodApiResponse updateVideoInfo(VodCredential authInfo) {
  9. string apiName = "UpdateVideoInfo";
  10. map<string, string> args;
  11. args["VideoId"] = "VideoId";
  12. args["Title"] = "new Title";
  13. args["Description"] = "new Description";
  14. args["Tags"] = "new Tag1,new Tag2";
  15. return getAcsResponse(authInfo, apiName, args);
  16. }
  17. // 请求示例
  18. void main() {
  19. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  20. VodApiResponse response = updateVideoInfo(authInfo);
  21. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  22. }

批量修改视频信息

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

  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 updateVideoInfos(VodCredential authInfo) {
  10. string apiName = "UpdateVideoInfos";
  11. map<string, string> args;
  12. Json::Value updateContentArray;
  13. Json::Value updateContent1;
  14. updateContent1["VideoId"] = "VideoId1";
  15. // updateContent1["Title"] = "new Title";
  16. // updateContent1["Tags"] = "new Tag1,new Tag2";
  17. updateContentArray.append(updateContent1);
  18. Json::Value updateContent2;
  19. updateContent2["VideoId"] = "VideoId2";
  20. // updateContent2["Title"] = "new Title";
  21. // updateContent2["Tags"] = "new Tag1,new Tag2";
  22. updateContentArray.append(updateContent2);
  23. args["UpdateContent"] = updateContentArray.toStyledString();
  24. return getAcsResponse(authInfo, apiName, args);
  25. }
  26. // 请求示例
  27. void main() {
  28. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  29. VodApiResponse response = updateVideoInfos(authInfo);
  30. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  31. }

删除视频

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 删除视频
  7. */
  8. VodApiResponse deleteVideo(VodCredential authInfo) {
  9. string apiName = "DeleteVideo";
  10. map<string, string> args;
  11. //多个用逗号分隔
  12. args["VideoIds"] = "VideoId1,VideoId2";
  13. return getAcsResponse(authInfo, apiName, args);
  14. }
  15. // 请求示例
  16. void main() {
  17. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  18. VodApiResponse response = deleteVideo(authInfo);
  19. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  20. }

获取源文件信息(含源片下载地址)

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 获取源文件信息
  7. */
  8. VodApiResponse getMezzanineInfo(VodCredential authInfo) {
  9. string apiName = "GetMezzanineInfo";
  10. map<string, string> args;
  11. args["VideoId"] = "<VideoId>";
  12. //源片下载地址过期时间,单位s
  13. args["AuthTimeout"] = "3600";
  14. return getAcsResponse(authInfo, apiName, args);
  15. }
  16. // 请求示例
  17. void main() {
  18. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. VodApiResponse response = getMezzanineInfo(authInfo);
  20. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  21. }

获取视频列表

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 获取视频列表
  7. */
  8. VodApiResponse getVideoList(VodCredential authInfo) {
  9. string apiName = "GetVideoList";
  10. map<string, string> args;
  11. args["PageNo"] = "1";
  12. args["PageSize"] = "20";
  13. args["StartTime"] = "2018-12-27T09:00:38Z";
  14. args["EndTime"] = "2018-12-28T09:00:38Z";
  15. return getAcsResponse(authInfo, apiName, args);
  16. }
  17. // 请求示例
  18. void main() {
  19. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  20. VodApiResponse response = getVideoList(authInfo);
  21. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  22. }

删除媒体流

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 删除媒体流函数
  7. */
  8. VodApiResponse deleteStream(VodCredential authInfo) {
  9. string apiName = "DeleteStream";
  10. map<string, string> args;
  11. args["VideoId"] = "<VideoId>";
  12. args["JobIds"] = "JobId1,JobId2";
  13. return getAcsResponse(authInfo, apiName, args);
  14. }
  15. // 请求示例
  16. void main() {
  17. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  18. VodApiResponse response = deleteStream(authInfo);
  19. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  20. }

批量删除源文件

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 批量删除源文件函数
  7. */
  8. VodApiResponse deleteMezzanines(VodCredential authInfo) {
  9. string apiName = "DeleteMezzanines";
  10. map<string, string> args;
  11. args["VideoIds"] = "VideoId1,VideoId2";
  12. args["Force"] = "false";
  13. return getAcsResponse(authInfo, apiName, args);
  14. }
  15. // 请求示例
  16. void main() {
  17. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  18. VodApiResponse response = deleteMezzanines(authInfo);
  19. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  20. }

批量更新图片信息

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

  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 updateImageInfos(VodCredential authInfo) {
  10. string apiName = "UpdateImageInfos";
  11. map<string, string> args;
  12. Json::Value updateContentArray;
  13. Json::Value updateContent1;
  14. updateContent1["ImageId"] = "ImageId1";
  15. // updateContent1["Title"] = "new Title";
  16. // updateContent1["Tags"] = "new Tag1,new Tag2";
  17. updateContentArray.append(updateContent1);
  18. Json::Value updateContent2;
  19. updateContent2["ImageId"] = "ImageId2";
  20. // updateContent2["Title"] = "new Title";
  21. // updateContent2["Tags"] = "new Tag1,new Tag2";
  22. updateContentArray.append(updateContent2);
  23. args["UpdateContent"] = updateContentArray.toStyledString();
  24. return getAcsResponse(authInfo, apiName, args);
  25. }
  26. // 请求示例
  27. void main() {
  28. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  29. VodApiResponse response = updateImageInfos(authInfo);
  30. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  31. }

获取图片信息

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 获取图片信息函数
  7. */
  8. VodApiResponse getImageInfo(VodCredential authInfo) {
  9. string apiName = "GetImageInfo";
  10. map<string, string> args;
  11. args["ImageId"] = "<ImageId>";
  12. return getAcsResponse(authInfo, apiName, args);
  13. }
  14. // 请求示例
  15. void main() {
  16. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  17. VodApiResponse response = getImageInfo(authInfo);
  18. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  19. }

删除图片

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

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /**
  6. * 删除图片函数
  7. */
  8. VodApiResponse deleteImage(VodCredential authInfo) {
  9. string apiName = "DeleteImage";
  10. map<string, string> args;
  11. //根据ImageURL删除图片文件
  12. args["DeleteImageType"] = "ImageURL";
  13. args["ImageURLs"] = "http://sample.aliyun.com/cover.jpg";
  14. //根据ImageId删除图片文件
  15. args["DeleteImageType"] = "ImageId";
  16. args["ImageIds"] = "ImageId1,ImageId2";
  17. //根据VideoId删除指定ImageType的图片文件
  18. args["DeleteImageType"] = "VideoId";
  19. args["VideoId"] = "<VideoId>";
  20. args["ImageType"] = "SpriteSnapshot";
  21. return getAcsResponse(authInfo, apiName, args);
  22. }
  23. // 请求示例
  24. void main() {
  25. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  26. VodApiResponse response = deleteImage(authInfo);
  27. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  28. }