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

Function main

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

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, inputUri, outputUri, preset) {
19 // [START transcoder_create_job_from_preset]
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 // preset = 'preset/web-hd';
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 createJobFromPreset() {
37 // Construct request
38 const request = {
39 parent: transcoderServiceClient.locationPath(projectId, location),
40 job: {
41 inputUri: inputUri,
42 outputUri: outputUri,
43 templateId: preset,
44 },
45 };
46
47 // Run request
48 const [response] = await transcoderServiceClient.createJob(request);
49 console.log(`Job: ${response.name}`);
50 }
51
52 createJobFromPreset();
53 // [END transcoder_create_job_from_preset]
54}
55
56// node createJobFromPreset.js <projectId> <location> <inputUri> <outputUri> <preset>
57process.on('unhandledRejection', err => {

Callers 1

Calls 1

createJobFromPresetFunction · 0.70

Tested by

no test coverage detected