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

Function main

media/video-stitcher/createLiveConfig.js:18–61  ·  view source on GitHub ↗
(projectId, location, liveConfigId, sourceUri, adTagUri, slateId)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, liveConfigId, sourceUri, adTagUri, slateId) {
19 // [START videostitcher_create_live_config]
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 // sourceUri = 'https://storage.googleapis.com/my-bucket/main.mpd';
27 // See Single Inline Linear
28 // (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags)
29 // adTagUri = 'https://pubads.g.doubleclick.net/gampad/ads...';
30 // slateId = 'my-slate';
31
32 // Imports the Video Stitcher library
33 const {VideoStitcherServiceClient} =
34 require('@google-cloud/video-stitcher').v1;
35 // Instantiates a client
36 const stitcherClient = new VideoStitcherServiceClient();
37
38 async function createLiveConfig() {
39 // Construct request
40 const request = {
41 parent: stitcherClient.locationPath(projectId, location),
42 liveConfig: {
43 sourceUri: sourceUri,
44 adTagUri: adTagUri,
45 adTracking: 'SERVER',
46 stitchingPolicy: 'CUT_CURRENT',
47 defaultSlate: stitcherClient.slatePath(projectId, location, slateId),
48 },
49 liveConfigId: liveConfigId,
50 };
51 const [operation] = await stitcherClient.createLiveConfig(request);
52 const [response] = await operation.promise();
53 console.log(`response.name: ${response.name}`);
54 }
55
56 createLiveConfig().catch(err => {
57 console.error(err.message);
58 process.exitCode = 1;
59 });
60 // [END videostitcher_create_live_config]
61}
62
63// node createLiveConfig.js <projectId> <location> <liveConfigId> <sourceUri> <adTagUri> <slateId>
64main(...process.argv.slice(2));

Callers 1

Calls 1

createLiveConfigFunction · 0.85

Tested by

no test coverage detected