All Products
Search
Document Center

Transcoding task

Last Updated: Jul 11, 2019

Initialize a client

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

Query the transcoding summary of videos

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

import com.aliyuncs.vod.model.v20170321.GetTranscodeSummaryRequest;
import com.aliyuncs.vod.model.v20170321.GetTranscodeSummaryResponse;

/**
 * Method for querying the transcoding summary of videos
 */
public static GetTranscodeSummaryResponse getTranscodeSummary(DefaultAcsClient client) throws Exception {
    GetTranscodeSummaryRequest request = new GetTranscodeSummaryRequest();
    request.setVideoIds("14f35e2c5ca348831c2d2ae1d5b2801,1dd4516420d247c777538c9aaafb01");
    return client.getAcsResponse(request);
}


/**
 * Call example
 */
public static void main(String[] args) throws ClientException {
    DefaultAcsClient client = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    GetTranscodeSummaryResponse response = new GetTranscodeSummaryResponse();
    try {
        response = getTranscodeSummary(client);
        for (GetTranscodeSummaryResponse.TranscodeSummary summary : response.getTranscodeSummaryList()) {
            // The transcoding status.
            System.out.println("TranscodeStatus = " + summary.getTranscodeStatus());
            for (GetTranscodeSummaryResponse.TranscodeSummary.TranscodeJobInfoSummary jobInfoSummary : summary.getTranscodeJobInfoSummaryList()) {
                // The transcoding progress.
                System.out.println("TranscodeProgress = " + jobInfoSummary.getTranscodeProgress());
                // The status of the transcoding job.
                System.out.println("TranscodeJobStatus = " + jobInfoSummary.getTranscodeJobStatus());
                // The completion time of the transcoding job.
                System.out.println("CompleteTime = " + jobInfoSummary.getCompleteTime());
            }
        }
    } catch (Exception e) {
        System.out.println("ErrorMessage = " + e.getLocalizedMessage());
    }
    System.out.println("RequestId = " + response.getRequestId());
}

Query a list of transcoding tasks

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

import com.aliyuncs.vod.model.v20170321.ListTranscodeTaskRequest;
import com.aliyuncs.vod.model.v20170321.ListTranscodeTaskResponse;

/**
 * Method for querying a list of transcoding tasks
 */
public static ListTranscodeTaskResponse listTranscodeTask(DefaultAcsClient client) throws Exception {
    ListTranscodeTaskRequest request = new ListTranscodeTaskRequest();
    request.setVideoId("14f35e2c5ca345cb88de1d5b2801");
    return client.getAcsResponse(request);
}


/**
 * Call example
 */
public static void main(String[] args) throws ClientException {
    DefaultAcsClient client = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    ListTranscodeTaskResponse response = new ListTranscodeTaskResponse();
    try {
        response = listTranscodeTask(client);
        for (ListTranscodeTaskResponse.TranscodeTask transcodeTask : response.getTranscodeTaskList()) {
            // The ID of the transcoding task.
            System.out.println("TranscodeTaskId = " + transcodeTask.getTranscodeTaskId());
            // The status of the transcoding task.
            System.out.println("TaskStatus = " + transcodeTask.getTaskStatus());
        }
    } catch (Exception e) {
        System.out.println("ErrorMessage = " + e.getLocalizedMessage());
    }
    System.out.println("RequestId = " + response.getRequestId());
}

Query the details about a transcoding task

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

import com.aliyuncs.vod.model.v20170321.GetTranscodeTaskRequest;
import com.aliyuncs.vod.model.v20170321.GetTranscodeTaskResponse;

/**
 * Method for querying the details about a transcoding task
 */
public static GetTranscodeTaskResponse getTranscodeTask(DefaultAcsClient client) throws Exception {
    GetTranscodeTaskRequest request = new GetTranscodeTaskRequest();
    request.setTranscodeTaskId("eab6f992b5f9436e6f425a421");
    return client.getAcsResponse(request);
}


/**
 * Call example
 */
public static void main(String[] args) throws ClientException {
    DefaultAcsClient client = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    GetTranscodeTaskResponse response = new GetTranscodeTaskResponse();
    try {
        response = getTranscodeTask(client);
        // The ID of the transcoding task.
        System.out.println("TranscodeTaskId = " + response.getTranscodeTask().getTranscodeTaskId());
        // The status of the transcoding task.
        System.out.println("TaskStatus = " + response.getTranscodeTask().getTaskStatus());
        for (GetTranscodeTaskResponse.TranscodeTask.TranscodeJobInfo jobInfo : response.getTranscodeTask().getTranscodeJobInfoList()) {
            // The ID of the transcoding job.
            System.out.println("TranscodeJobId = " + jobInfo.getTranscodeJobId());
            // The status of the transcoding job.
            System.out.println("TranscodeJobStatus = " + jobInfo.getTranscodeJobStatus());
            // The transcoding progress.
            System.out.println("TranscodeProgress = " + jobInfo.getTranscodeProgress());
            // The completion time of the transcoding job.
            System.out.println("CompleteTime = " + jobInfo.getCompleteTime());

        }
    } catch (Exception e) {
        System.out.println("ErrorMessage = " + e.getLocalizedMessage());
    }
    System.out.println("RequestId = " + response.getRequestId());
}