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());
}
}
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());
}
}
}
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());
}
}
Aggregations