| 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 | ], |
| 76 | muxStreams: [ |
| 77 | { |
| 78 | key: 'mux_video', |
| 79 | elementaryStreams: ['es_video'], |
| 80 | segmentSettings: { |
| 81 | seconds: 2, |
| 82 | }, |
| 83 | }, |
| 84 | { |
| 85 | key: 'mux_audio', |
| 86 | elementaryStreams: ['es_audio'], |
| 87 | segmentSettings: { |
| 88 | seconds: 2, |
| 89 | }, |
| 90 | }, |
| 91 | ], |
| 92 | manifests: [ |