All Products
Search
Document Center

Media asset management

Last Updated: Jul 11, 2019

Initialize a client

Initialize a client before using the SDK. For more information, see initVodClient.

Search for media asset information

For more information about the request and response parameters, see SearchMedia.

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for searching for media asset information
*/
VodApiResponse searchMedia(VodCredential authInfo) {
    string apiName = "SearchMedia";
    map<string, string> args; 
    args["Fields"] = "Title,CoverURL,Status";
    args["Match"] = "Status in ('Normal','Checking') and CreationTime = ('2018-07-01T08:00:00Z','2018-08-01T08:00:00Z')";
    args["PageNo"] = "1";
    args["PageSize"] = "10";
    args["SearchType"] = "video";
    args["SortBy"] = "CreationTime:Desc";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = searchMedia(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Obtain video information

For more information about the request and response parameters, see GetVideoInfo.

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for obtaining video information
*/
VodApiResponse getVideoInfo(VodCredential authInfo) {
    string apiName = "GetVideoInfo";
    map<string, string> args; 
    args["VideoId"] = "<VideoId>"; 
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getVideoInfo(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Obtain the information about multiple videos

For more information about the request and response parameters, see GetVideoInfos.

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for obtaining the information about multiple videos
*/
VodApiResponse getVideoInfos(VodCredential authInfo) {
    string apiName = "GetVideoInfos";
    map<string, string> args; 
    args["VideoIds"] = "VideoId1,VideoId2";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getVideoInfos(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Modify video information

For more information about the request and response parameters, see UpdateVideoInfo.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for modifying video information
*/
VodApiResponse updateVideoInfo(VodCredential authInfo) {
    string apiName = "UpdateVideoInfo";
    map<string, string> args;
    args["VideoId"] = "VideoId";
    args["Title"] = "new Title";
    args["Description"] = "new Description";
    args["Tags"] = "new Tag1,new Tag2";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = updateVideoInfo(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Modify the information about multiple videos

For more information about the request and response parameters, see UpdateVideoInfos.

#include <stdio.h> 
#include <string>
#include <map>
#include <jsoncpp/json/json.h> 
#include "vod_sdk/openApiUtil.h"

/**
 * Method for modifying the information about multiple videos
*/
VodApiResponse updateVideoInfos(VodCredential authInfo) {
    string apiName = "UpdateVideoInfos";
    map<string, string> args;
    Json::Value updateContentArray;
    Json::Value updateContent1;
    updateContent1["VideoId"] = "VideoId1";
    // updateContent1["Title"] = "new Title";
    // updateContent1["Tags"] = "new Tag1,new Tag2";
    updateContentArray.append(updateContent1);
    Json::Value updateContent2;
    updateContent2["VideoId"] = "VideoId2";
    // updateContent2["Title"] = "new Title";
    // updateContent2["Tags"] = "new Tag1,new Tag2";
    updateContentArray.append(updateContent2);
    args["UpdateContent"] = updateContentArray.toStyledString();
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = updateVideoInfos(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Delete videos

For more information about the request and response parameters, see DeleteVideo.

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for deleting videos
*/
VodApiResponse deleteVideo(VodCredential authInfo) {
    string apiName = "DeleteVideo";
    map<string, string> args;
    // Specifies one or more IDs of the videos to be deleted. Separate multiple video IDs with a comma (,).
    args["VideoIds"] = "VideoId1,VideoId2";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = deleteVideo(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Obtain mezzanine file information (including the mezzanine file download URL)

For more information about the request and response parameters, see GetMezzanineInfo.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for obtaining mezzanine file information
*/
VodApiResponse getMezzanineInfo(VodCredential authInfo) {
    string apiName = "GetMezzanineInfo";
    map<string, string> args;
    args["VideoId"] = "<VideoId>"; 
    // Sets the expiration time of the mezzanine file download URL, in seconds.
    args["AuthTimeout"] = "3600";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getMezzanineInfo(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Obtain a video list

For more information about the request and response parameters, see GetVideoList.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for obtaining a video list
*/
VodApiResponse getVideoList(VodCredential authInfo) {
    string apiName = "GetVideoList";
    map<string, string> args;
    args["PageNo"] = "1";
    args["PageSize"] = "20";
    args["StartTime"] = "2018-12-27T09:00:38Z";
    args["EndTime"] = "2018-12-28T09:00:38Z";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getVideoList(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Delete media streams

For more information about the request and response parameters, see DeleteStream.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for deleting media streams
*/
VodApiResponse deleteStream(VodCredential authInfo) {
    string apiName = "DeleteStream";
    map<string, string> args;
    args["VideoId"] = "<VideoId>"; 
    args["JobIds"] = "JobId1,JobId2";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = deleteStream(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Delete multiple mezzanine files

For more information about the request and response parameters, see DeleteMezzanines.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for deleting multiple mezzanine files
*/
VodApiResponse deleteMezzanines(VodCredential authInfo) {
    string apiName = "DeleteMezzanines";
    map<string, string> args;
    args["VideoIds"] = "VideoId1,VideoId2";
    args["Force"] = "false";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = deleteMezzanines(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Update the information about multiple images

For more information about the request and response parameters, see UpdateImageInfos.

#include <stdio.h> 
#include <string>
#include <map>
#include <jsoncpp/json/json.h> 
#include "vod_sdk/openApiUtil.h"

/**
 * Method for updating the information about multiple images
*/
VodApiResponse updateImageInfos(VodCredential authInfo) {
    string apiName = "UpdateImageInfos";
    map<string, string> args;
    Json::Value updateContentArray;
    Json::Value updateContent1;
    updateContent1["ImageId"] = "ImageId1";
    // updateContent1["Title"] = "new Title";
    // updateContent1["Tags"] = "new Tag1,new Tag2";
    updateContentArray.append(updateContent1);
    Json::Value updateContent2;
    updateContent2["ImageId"] = "ImageId2";
    // updateContent2["Title"] = "new Title";
    // updateContent2["Tags"] = "new Tag1,new Tag2";
    updateContentArray.append(updateContent2);
    args["UpdateContent"] = updateContentArray.toStyledString();
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = updateImageInfos(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Obtain image information

For more information about the request and response parameters, see GetImageInfo.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for obtaining image information
*/
VodApiResponse getImageInfo(VodCredential authInfo) {
    string apiName = "GetImageInfo";
    map<string, string> args;
    args["ImageId"] = "<ImageId>"; 
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getImageInfo(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

Delete images

For more information about the request and response parameters, see DeleteImage.

#include <stdio.h> 
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/**
 * Method for deleting images
*/
VodApiResponse deleteImage(VodCredential authInfo) {
    string apiName = "DeleteImage";
    map<string, string> args;
    // Deletes image files based on image URLs.
    args["DeleteImageType"] = "ImageURL";
    args["ImageURLs"] = "http://sample.aliyun.com/cover.jpg";    
    // Deletes image files based on image IDs.
    args["DeleteImageType"] = "ImageId";
    args["ImageIds"] = "ImageId1,ImageId2";
    // Deletes image files of the specified image type based on a video ID.
    args["DeleteImageType"] = "VideoId";
    args["VideoId"] = "<VideoId>"; 
    args["ImageType"] = "SpriteSnapshot";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = deleteImage(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}