(projectId, location, inputUri, outputUri, templateId)
| 16 | 'use strict'; |
| 17 | |
| 18 | function 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> |
| 57 | process.on('unhandledRejection', err => { |
no test coverage detected