Search in sources :

Example 1 with DescribeMediaInfosRequest

use of com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest in project cloud-sdk by mizhousoft.

the class QCloudVODServiceImpl method getVideoMeta.

/**
 * {@inheritDoc}
 */
@Override
public MediaMeta getVideoMeta(String fileId) throws CloudSDKException {
    try {
        String[] fileIds = { fileId };
        DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
        req.setFileIds(fileIds);
        DescribeMediaInfosResponse resp = vodClient.DescribeMediaInfos(req);
        MediaInfo[] mediaInfos = resp.getMediaInfoSet();
        if (null != mediaInfos && 1 == mediaInfos.length) {
            MediaInfo mediaInfo = mediaInfos[0];
            MediaMeta meta = buildMediaMeta(fileId, mediaInfo.getBasicInfo(), mediaInfo.getMetaData(), mediaInfo.getTranscodeInfo());
            return meta;
        } else {
            return null;
        }
    } catch (TencentCloudSDKException e) {
        throw new CloudSDKException(e.getErrorCode(), e.getMessage(), e);
    }
}
Also used : CloudSDKException(com.mizhousoft.cloudsdk.CloudSDKException) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) MediaInfo(com.tencentcloudapi.vod.v20180717.models.MediaInfo) MediaMeta(com.mizhousoft.cloudsdk.vod.MediaMeta) DescribeMediaInfosRequest(com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest) DescribeMediaInfosResponse(com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse)

Aggregations

CloudSDKException (com.mizhousoft.cloudsdk.CloudSDKException)1 MediaMeta (com.mizhousoft.cloudsdk.vod.MediaMeta)1 TencentCloudSDKException (com.tencentcloudapi.common.exception.TencentCloudSDKException)1 DescribeMediaInfosRequest (com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest)1 DescribeMediaInfosResponse (com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse)1 MediaInfo (com.tencentcloudapi.vod.v20180717.models.MediaInfo)1