Search in sources :

Example 6 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class TranscodeTemplateDemo method deleteMediaTemplate.

/**
 * DeleteMediaTemplate 用于删除转码模板。
 *
 * @param client
 */
public static void deleteMediaTemplate(COSClient client) {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTemplateId("t1619b0381be1a46738796e97fff4*****");
    // 3.调用接口,获取模板响应对象
    Boolean response = client.deleteMediaTemplate(request);
    System.out.println(response);
}
Also used : MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)

Example 7 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest 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);
}
Also used : MediaTemplateResponse(com.qcloud.cos.model.ciModel.template.MediaTemplateResponse) MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest) MediaTemplateObject(com.qcloud.cos.model.ciModel.template.MediaTemplateObject) MediaListTemplateResponse(com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse) Test(org.junit.Test)

Example 8 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class AnimationTemplateDemo method deleteMediaTemplate.

/**
 * DeleteMediaTemplate 用于删除动图模板。
 *
 * @param client
 */
public static void deleteMediaTemplate(COSClient client) {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTemplateId("t19c4a60ae1a694621a01f0c713******");
    // 3.调用接口,获取模板响应对象
    Boolean response = client.deleteMediaTemplate(request);
    System.out.println(response);
}
Also used : MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)

Example 9 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class AnimationTemplateDemo method updateMediaTemplate.

/**
 * UpdateMediaTemplate 用于更新动图模板。
 *
 * @param client
 */
public static void updateMediaTemplate(COSClient client) throws UnsupportedEncodingException {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTemplateId("t1bc837f9ff52c4203b73ee3378f4*****");
    request.setTag("Animation");
    request.setName("updateName1");
    request.getContainer().setFormat("gif");
    request.getVideo().setCodec("gif");
    // 3.调用接口,获取模板响应对象
    Boolean aBoolean = client.updateMediaTemplate(request);
    System.out.println(aBoolean);
}
Also used : MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)

Example 10 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class SnapshotTemplateDemo method updateMediaTemplate.

/**
 * UpdateMediaTemplate 用于更新截图模板。
 *
 * @param client
 */
public static void updateMediaTemplate(COSClient client) throws UnsupportedEncodingException {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTemplateId("t1e9679e24887e401eb3f46282fb9*****");
    request.setTag("Snapshot");
    request.setName("mark-test-update");
    request.getSnapshot().setMode("Interval");
    request.getSnapshot().setWidth("1280");
    request.getSnapshot().setStart("0");
    request.getSnapshot().setCount("2");
    // 3.调用接口,获取模板响应对象
    Boolean aBoolean = client.updateMediaTemplate(request);
    System.out.println(aBoolean);
}
Also used : MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)

Aggregations

MediaTemplateRequest (com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)13 MediaListTemplateResponse (com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse)4 MediaTemplateObject (com.qcloud.cos.model.ciModel.template.MediaTemplateObject)4 MediaTemplateResponse (com.qcloud.cos.model.ciModel.template.MediaTemplateResponse)4 MediaAudioObject (com.qcloud.cos.model.ciModel.job.MediaAudioObject)2 MediaTimeIntervalObject (com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject)2 MediaTransConfigObject (com.qcloud.cos.model.ciModel.job.MediaTransConfigObject)2 MediaVideoObject (com.qcloud.cos.model.ciModel.job.MediaVideoObject)2 Test (org.junit.Test)1