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

Function main

media/livestream/createInput.js:18–52  ·  view source on GitHub ↗
(projectId, location, inputId)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, inputId) {
19 // [START livestream_create_input]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // inputId = 'my-input';
26
27 // Imports the Livestream library
28 const {LivestreamServiceClient} = require('@google-cloud/livestream').v1;
29
30 // Instantiates a client
31 const livestreamServiceClient = new LivestreamServiceClient();
32
33 async function createInput() {
34 // Construct request
35 const request = {
36 parent: livestreamServiceClient.locationPath(projectId, location),
37 inputId: inputId,
38 input: {
39 type: 'RTMP_PUSH',
40 },
41 };
42
43 // Run request
44 const [operation] = await livestreamServiceClient.createInput(request);
45 const response = await operation.promise();
46 const [input] = response;
47 console.log(`Input: ${input.name}`);
48 }
49
50 createInput();
51 // [END livestream_create_input]
52}
53
54// node createInput.js <projectId> <location> <inputId>
55process.on('unhandledRejection', err => {

Callers 1

createInput.jsFile · 0.70

Calls 1

createInputFunction · 0.85

Tested by

no test coverage detected