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

Function main

media/video-stitcher/createLiveSession.js:18–56  ·  view source on GitHub ↗
(projectId, location, liveConfigId)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, liveConfigId) {
19 // [START videostitcher_create_live_session]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // liveConfigId = 'my-live-config-id';
26
27 // Imports the Video Stitcher library
28 const {VideoStitcherServiceClient} =
29 require('@google-cloud/video-stitcher').v1;
30 // Instantiates a client
31 const stitcherClient = new VideoStitcherServiceClient();
32
33 async function createLiveSession() {
34 // Construct request
35 const request = {
36 parent: stitcherClient.locationPath(projectId, location),
37 liveSession: {
38 liveConfig: stitcherClient.liveConfigPath(
39 projectId,
40 location,
41 liveConfigId
42 ),
43 },
44 };
45
46 const [session] = await stitcherClient.createLiveSession(request);
47 console.log(`Live session: ${session.name}`);
48 console.log(`Play URI: ${session.playUri}`);
49 }
50
51 createLiveSession().catch(err => {
52 console.error(err.message);
53 process.exitCode = 1;
54 });
55 // [END videostitcher_create_live_session]
56}
57
58// node createLiveSession.js <projectId> <location> <liveConfigId>
59main(...process.argv.slice(2));

Callers 1

Calls 1

createLiveSessionFunction · 0.85

Tested by

no test coverage detected