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

Function main

media/livestream/createChannel.js:18–112  ·  view source on GitHub ↗
(projectId, location, channelId, inputId, outputUri)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, channelId, inputId, outputUri) {
19 // [START livestream_create_channel]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // channelId = 'my-channel';
26 // inputId = 'my-input';
27 // outputUri = 'gs://my-bucket/my-output-folder/';
28
29 // Imports the Livestream library
30 const {LivestreamServiceClient} = require('@google-cloud/livestream').v1;
31
32 // Instantiates a client
33 const livestreamServiceClient = new LivestreamServiceClient();
34
35 async function createChannel() {
36 // Construct request
37 const request = {
38 parent: livestreamServiceClient.locationPath(projectId, location),
39 channelId: channelId,
40 channel: {
41 inputAttachments: [
42 {
43 key: 'my-input',
44 input: livestreamServiceClient.inputPath(
45 projectId,
46 location,
47 inputId
48 ),
49 },
50 ],
51 output: {
52 uri: outputUri,
53 },
54 elementaryStreams: [
55 {
56 key: 'es_video',
57 videoStream: {
58 h264: {
59 profile: 'high',
60 heightPixels: 720,
61 widthPixels: 1280,
62 bitrateBps: 3000000,
63 frameRate: 30,
64 },
65 },
66 },
67 {
68 key: 'es_audio',
69 audioStream: {
70 codec: 'aac',
71 channelCount: 2,
72 bitrateBps: 160000,
73 },
74 },
75 ],

Callers 1

createChannel.jsFile · 0.70

Calls 1

createChannelFunction · 0.85

Tested by

no test coverage detected