Search in sources :

Example 16 with TranscoderServiceClient

use of com.google.cloud.video.transcoder.v1.TranscoderServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class CreateJobFromPreset method createJobFromPreset.

// Creates a job from a preset.
public static void createJobFromPreset(String projectId, String location, String inputUri, String outputUri, String preset) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        var createJobRequest = CreateJobRequest.newBuilder().setJob(Job.newBuilder().setInputUri(inputUri).setOutputUri(outputUri).setTemplateId(preset).build()).setParent(LocationName.of(projectId, location).toString()).build();
        // Send the job creation request and process the response.
        Job job = transcoderServiceClient.createJob(createJobRequest);
        System.out.println("Job: " + job.getName());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) Job(com.google.cloud.video.transcoder.v1.Job)

Example 17 with TranscoderServiceClient

use of com.google.cloud.video.transcoder.v1.TranscoderServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class ListJobTemplates method listJobTemplates.

// Lists the job templates for a given location.
public static void listJobTemplates(String projectId, String location) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        var listJobTemplatesRequest = ListJobTemplatesRequest.newBuilder().setParent(LocationName.of(projectId, location).toString()).build();
        // Send the list job templates request and process the response.
        TranscoderServiceClient.ListJobTemplatesPagedResponse response = transcoderServiceClient.listJobTemplates(listJobTemplatesRequest);
        System.out.println("Job templates:");
        for (JobTemplate jobTemplate : response.iterateAll()) {
            System.out.println(jobTemplate.getName());
        }
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobTemplate(com.google.cloud.video.transcoder.v1.JobTemplate)

Example 18 with TranscoderServiceClient

use of com.google.cloud.video.transcoder.v1.TranscoderServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class GetJob method getJob.

// Gets a job.
public static void getJob(String projectId, String location, String jobId) throws IOException {
    // once, and can be reused for multiple requests.
    try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
        JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
        var getJobRequest = GetJobRequest.newBuilder().setName(jobName.toString()).build();
        // Send the get job request and process the response.
        Job job = transcoderServiceClient.getJob(getJobRequest);
        System.out.println("Job: " + job.getName());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobName(com.google.cloud.video.transcoder.v1.JobName) Job(com.google.cloud.video.transcoder.v1.Job)

Aggregations

TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)18 Job (com.google.cloud.video.transcoder.v1.Job)13 AudioStream (com.google.cloud.video.transcoder.v1.AudioStream)9 JobConfig (com.google.cloud.video.transcoder.v1.JobConfig)9 VideoStream (com.google.cloud.video.transcoder.v1.VideoStream)9 JobName (com.google.cloud.video.transcoder.v1.JobName)3 JobTemplate (com.google.cloud.video.transcoder.v1.JobTemplate)3 JobTemplateName (com.google.cloud.video.transcoder.v1.JobTemplateName)2 Overlay (com.google.cloud.video.transcoder.v1.Overlay)2 SpriteSheet (com.google.cloud.video.transcoder.v1.SpriteSheet)2 TextStream (com.google.cloud.video.transcoder.v1.TextStream)2 Animation (com.google.cloud.video.transcoder.v1.Overlay.Animation)1