Search in sources :

Example 1 with MediaJobResponse

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

the class MediaJobTest method describeMediaJobTest.

@Test
public void describeMediaJobTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest queueRequest = new MediaQueueRequest();
    queueRequest.setBucketName(bucket);
    MediaListQueueResponse queueResponse = cosclient.describeMediaQueues(queueRequest);
    if (queueResponse != null && queueResponse.getQueueList().size() != 0) {
        MediaJobsRequest request = new MediaJobsRequest();
        request.setBucketName(bucket);
        String queueId = queueResponse.getQueueList().get(0).getQueueId();
        request.setQueueId(queueId);
        request.setTag(TAG);
        MediaListJobResponse response = cosclient.describeMediaJobs(request);
        List<MediaJobObject> jobsDetail = response.getJobsDetailList();
        for (MediaJobObject mediaJobObject : jobsDetail) {
            request = new MediaJobsRequest();
            request.setBucketName(bucket);
            request.setJobId(mediaJobObject.getJobId());
            MediaJobResponse jobResponse = cosclient.describeMediaJob(request);
            System.out.println(jobResponse);
            assertEquals(queueId, jobResponse.getJobsDetail().getQueueId());
        }
    }
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaJobResponse(com.qcloud.cos.model.ciModel.job.MediaJobResponse) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) MediaJobObject(com.qcloud.cos.model.ciModel.job.MediaJobObject) MediaListJobResponse(com.qcloud.cos.model.ciModel.job.MediaListJobResponse) Test(org.junit.Test)

Example 2 with MediaJobResponse

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

the class JobDemo method createMediaJobs.

/**
 * createMediaJobs 接口用于创建媒体任务。
 * demo 使用模板创建任务,如需自定义模板请先使用创建模板接口
 *
 * @param client
 */
public static void createMediaJobs(COSClient client) throws UnsupportedEncodingException {
    // 1.创建任务请求对象
    MediaJobsRequest request = new MediaJobsRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTag("Transcode");
    request.getInput().setObject("1.mp4");
    request.getOperation().setTemplateId("t0e09a9456d4124542b1f0e44d501*****");
    request.getOperation().getOutput().setBucket("DemoBucket-123456789");
    request.getOperation().getOutput().setRegion("ap-chongqing");
    request.getOperation().getOutput().setObject("2.mp4");
    request.setQueueId("p9900025e4ec44b5e8225e70a52170834");
    request.setCallBack("https://cloud.tencent.com/xxx");
    // 3.调用接口,获取任务响应对象
    MediaJobResponse response = client.createMediaJobs(request);
    System.out.println(response);
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaJobResponse(com.qcloud.cos.model.ciModel.job.MediaJobResponse)

Example 3 with MediaJobResponse

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

the class JobDemo method describeMediaJob.

/**
 * describeMediaJob 根据jobId查询任务信息
 *
 * @param client
 */
public static void describeMediaJob(COSClient client) {
    // 1.创建任务请求对象
    MediaJobsRequest request = new MediaJobsRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setJobId("j2b27107ee3ad11ebbf6d73cb5317****");
    // 3.调用接口,获取任务响应对象
    MediaJobResponse response = client.describeMediaJob(request);
    System.out.println(response.getJobsDetail().getOperation().getTranscode());
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaJobResponse(com.qcloud.cos.model.ciModel.job.MediaJobResponse)

Example 4 with MediaJobResponse

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

the class JobDemo method createMediaJobs2.

/**
 * createMediaJobs 接口用于创建媒体任务
 * demo 使用转码参数创建任务 推荐使用模板创建媒体任务
 *
 * @param client
 */
public static void createMediaJobs2(COSClient client) throws UnsupportedEncodingException {
    // 1.创建任务请求对象
    MediaJobsRequest request = new MediaJobsRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTag("Transcode");
    request.getInput().setObject("1.mp4");
    // 2.1添加媒体任务操作参数
    MediaTranscodeObject transcode = request.getOperation().getTranscode();
    MediaContainerObject container = transcode.getContainer();
    container.setFormat("mp4");
    MediaTranscodeVideoObject video = transcode.getVideo();
    video.setCodec("H.264");
    video.setProfile("high");
    video.setBitrate("1000");
    video.setWidth("1280");
    video.setFps("30");
    video.setPreset("medium");
    video.setBufSize("0");
    video.setMaxrate("50000");
    MediaAudioObject audio = transcode.getAudio();
    audio.setCodec("aac");
    audio.setSamplerate("44100");
    audio.setBitrate("128");
    audio.setChannels("4");
    MediaTimeIntervalObject timeInterval = transcode.getTimeInterval();
    timeInterval.setStart("0");
    timeInterval.setDuration("60");
    MediaTransConfigObject transConfig = transcode.getTransConfig();
    // transConfig.setAdjDarMethod("scale");
    // transConfig.setIsCheckAudioBitrate("false");
    // transConfig.setResoAdjMethod("1");
    request.getOperation().getOutput().setBucket("DemoBucket-123456789");
    request.getOperation().getOutput().setRegion("ap-chongqing");
    request.getOperation().getOutput().setObject("demo1.mp4");
    request.setQueueId("p9900025e4ec44b5e8225e70a5217****");
    request.setCallBack("https://cloud.tencent.com/xxx");
    // 3.调用接口,获取任务响应对象
    MediaJobResponse response = client.createMediaJobs(request);
    System.out.println(response.getJobsDetail().getOperation().getTranscode());
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaTranscodeObject(com.qcloud.cos.model.ciModel.job.MediaTranscodeObject) MediaJobResponse(com.qcloud.cos.model.ciModel.job.MediaJobResponse) MediaAudioObject(com.qcloud.cos.model.ciModel.job.MediaAudioObject) MediaTimeIntervalObject(com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject) MediaTranscodeVideoObject(com.qcloud.cos.model.ciModel.job.MediaTranscodeVideoObject) MediaTransConfigObject(com.qcloud.cos.model.ciModel.job.MediaTransConfigObject) MediaContainerObject(com.qcloud.cos.model.ciModel.job.MediaContainerObject)

Aggregations

MediaJobResponse (com.qcloud.cos.model.ciModel.job.MediaJobResponse)4 MediaJobsRequest (com.qcloud.cos.model.ciModel.job.MediaJobsRequest)4 MediaAudioObject (com.qcloud.cos.model.ciModel.job.MediaAudioObject)1 MediaContainerObject (com.qcloud.cos.model.ciModel.job.MediaContainerObject)1 MediaJobObject (com.qcloud.cos.model.ciModel.job.MediaJobObject)1 MediaListJobResponse (com.qcloud.cos.model.ciModel.job.MediaListJobResponse)1 MediaTimeIntervalObject (com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject)1 MediaTransConfigObject (com.qcloud.cos.model.ciModel.job.MediaTransConfigObject)1 MediaTranscodeObject (com.qcloud.cos.model.ciModel.job.MediaTranscodeObject)1 MediaTranscodeVideoObject (com.qcloud.cos.model.ciModel.job.MediaTranscodeVideoObject)1 MediaListQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse)1 MediaQueueRequest (com.qcloud.cos.model.ciModel.queue.MediaQueueRequest)1 Test (org.junit.Test)1