MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

media/transcoder/createJobFromTemplate.js:18–54  ·  view source on GitHub ↗
(projectId, location, inputUri, outputUri, templateId)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, inputUri, outputUri, templateId) {
19 // [START transcoder_create_job_from_template]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // inputUri = 'gs://my-bucket/my-video-file';
26 // outputUri = 'gs://my-bucket/my-output-folder/';
27 // templateId = 'my-job-template';
28
29 // Imports the Transcoder library
30 const {TranscoderServiceClient} =
31 require('@google-cloud/video-transcoder').v1;
32
33 // Instantiates a client
34 const transcoderServiceClient = new TranscoderServiceClient();
35
36 async function createJobFromTemplate() {
37 // Construct request
38 const request = {
39 parent: transcoderServiceClient.locationPath(projectId, location),
40 job: {
41 inputUri: inputUri,
42 outputUri: outputUri,
43 templateId: templateId,
44 },
45 };
46
47 // Run request
48 const [response] = await transcoderServiceClient.createJob(request);
49 console.log(`Job: ${response.name}`);
50 }
51
52 createJobFromTemplate();
53 // [END transcoder_create_job_from_template]
54}
55
56// node createJobFromTemplate.js <projectId> <location> <inputUri> <outputUri> <templateId>
57process.on('unhandledRejection', err => {

Callers 1

Calls 1

createJobFromTemplateFunction · 0.85

Tested by

no test coverage detected