use of com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse in project cos-java-sdk-v5 by tencentyun.
the class AnimationTemplateDemo method describeMediaTemplates.
/**
* DescribeMediaTemplates 用于查询动图模板。
*
* @param client
*/
public static void describeMediaTemplates(COSClient client) {
// 1.创建模板请求对象
MediaTemplateRequest request = new MediaTemplateRequest();
// 2.添加请求参数 参数详情请见api接口文档
request.setBucketName("DemoBucket-123456789");
// 3.调用接口,获取模板响应对象
MediaListTemplateResponse response = client.describeMediaTemplates(request);
List<MediaTemplateObject> templateList = response.getTemplateList();
for (MediaTemplateObject mediaTemplateObject : templateList) {
System.out.println(mediaTemplateObject);
}
}
use of com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse in project cos-java-sdk-v5 by tencentyun.
the class SnapshotTemplateDemo method describeMediaTemplates.
/**
* DescribeMediaTemplates 用于查询截图模板。
*
* @param client
*/
public static void describeMediaTemplates(COSClient client) {
// 1.创建模板请求对象
MediaTemplateRequest request = new MediaTemplateRequest();
// 2.添加请求参数 参数详情请见api接口文档
request.setBucketName("DemoBucket-123456789");
request.setTag("Snapshot");
// 3.调用接口,获取模板响应对象
MediaListTemplateResponse response = client.describeMediaTemplates(request);
List<MediaTemplateObject> templateList = response.getTemplateList();
for (MediaTemplateObject mediaTemplateObject : templateList) {
System.out.println(mediaTemplateObject);
}
System.out.println(response);
}
use of com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse in project cos-java-sdk-v5 by tencentyun.
the class MediaTemplateTest method mediaTemplateTest.
@Test
public void mediaTemplateTest() {
if (!judgeUserInfoValid()) {
return;
}
MediaTemplateRequest request = new MediaTemplateRequest();
request.setBucketName(bucket);
request.setTag(TAG);
request.setName(Long.valueOf(System.currentTimeMillis()).toString());
request.getContainer().setFormat(FORMAT);
request.getVideo().setCodec(CODEC);
request.getVideo().setWidth(WIDTH);
request.getVideo().setFps(FPS);
request.getVideo().setAnimateOnlyKeepKeyFrame(ANIMATE_ONLY_KEEP_KEY_FRAME);
request.getTimeInterval().setStart(START);
request.getTimeInterval().setDuration(DURATION);
MediaTemplateResponse response = cosclient.createMediaTemplate(request);
MediaTemplateObject template = response.getTemplate();
Assert.assertEquals(bucket, template.getBucketId());
Assert.assertEquals(TAG, template.getTag());
Assert.assertEquals(FORMAT, template.getTransTpl().getContainer().getFormat());
Assert.assertEquals(CODEC, template.getTransTpl().getVideo().getCodec());
Assert.assertEquals(START, template.getTransTpl().getTimeInterval().getStart());
request = new MediaTemplateRequest();
request.setBucketName(bucket);
MediaListTemplateResponse templates = cosclient.describeMediaTemplates(request);
List<MediaTemplateObject> templateList = templates.getTemplateList();
Assert.assertTrue(templateList.size() >= 1);
for (MediaTemplateObject mediaTemplateObject : templateList) {
if (response.getTemplate().getTemplateId().equals(mediaTemplateObject.getTemplateId())) {
Assert.assertEquals(bucket, mediaTemplateObject.getBucketId());
Assert.assertEquals(TAG, mediaTemplateObject.getTag());
Assert.assertEquals(FORMAT, mediaTemplateObject.getTransTpl().getContainer().getFormat());
Assert.assertEquals(CODEC, mediaTemplateObject.getTransTpl().getVideo().getCodec());
Assert.assertEquals(START, mediaTemplateObject.getTransTpl().getTimeInterval().getStart());
}
}
request = new MediaTemplateRequest();
request.setBucketName(bucket);
request.setTemplateId(response.getTemplate().getTemplateId());
Boolean aBoolean = cosclient.deleteMediaTemplate(request);
Assert.assertTrue(aBoolean);
}
use of com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse in project cos-java-sdk-v5 by tencentyun.
the class TranscodeTemplateDemo method describeMediaTemplates.
/**
* DescribeMediaTemplates 用于查询转码模板。
*
* @param client
*/
public static void describeMediaTemplates(COSClient client) {
// 1.创建模板请求对象
MediaTemplateRequest request = new MediaTemplateRequest();
// 2.添加请求参数 参数详情请见api接口文档
request.setBucketName("DemoBucket-123456789");
request.setTag("Transcode");
// 3.调用接口,获取模板响应对象
MediaListTemplateResponse response = client.describeMediaTemplates(request);
List<MediaTemplateObject> templateList = response.getTemplateList();
for (MediaTemplateObject mediaTemplateObject : templateList) {
System.out.println(mediaTemplateObject);
}
}
Aggregations