-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add Video Stitcher VOD and live session code samples a… (
#9) * docs(samples): add Video Stitcher VOD and live session code samples and tests * Remove async from slate and live session before and after hooks * clean out old slates and CDN keys * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update SHA Co-authored-by: sofisl <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3cc9dd0
commit 440fc24
Showing
11 changed files
with
793 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sourceUri, adTagUri, slateId) { | ||
// [START video_stitcher_create_live_session] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sourceUri = 'https://storage.googleapis.com/my-bucket/main.mpd'; | ||
// Single Inline Linear (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) | ||
// (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) | ||
// adTagUri = 'https://pubads.g.doubleclick.net/gampad/ads...'; | ||
// slateId = 'my-slate'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function createLiveSession() { | ||
// Construct request | ||
const request = { | ||
parent: stitcherClient.locationPath(projectId, location), | ||
liveSession: { | ||
sourceUri: sourceUri, | ||
adTagMap: { | ||
default: { | ||
uri: adTagUri, | ||
}, | ||
}, | ||
defaultSlateId: slateId, | ||
}, | ||
}; | ||
|
||
const [session] = await stitcherClient.createLiveSession(request); | ||
console.log(`Live session: ${session.name}`); | ||
console.log(`Play URI: ${session.playUri}`); | ||
} | ||
|
||
createLiveSession(); | ||
// [END video_stitcher_create_live_session] | ||
} | ||
|
||
// node createLiveSession.js <projectId> <location> <sourceUri> <adTagUri> <slateId> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sourceUri, adTagUri) { | ||
// [START video_stitcher_create_vod_session] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sourceUri = 'https://storage.googleapis.com/my-bucket/main.mpd'; | ||
// See VMAP Pre-roll | ||
// (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) | ||
// adTagUri = 'https://pubads.g.doubleclick.net/gampad/ads...'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function createVodSession() { | ||
// Construct request | ||
const request = { | ||
parent: stitcherClient.locationPath(projectId, location), | ||
vodSession: { | ||
sourceUri: sourceUri, | ||
adTagUri: adTagUri, | ||
}, | ||
}; | ||
const [session] = await stitcherClient.createVodSession(request); | ||
console.log(`VOD session: ${session.name}`); | ||
} | ||
|
||
createVodSession(); | ||
// [END video_stitcher_create_vod_session] | ||
} | ||
|
||
// node createVodSession.js <projectId> <location> <sourceUri> <adTagUri> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sessionId, adTagDetailId) { | ||
// [START video_stitcher_get_live_ad_tag_detail] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sessionId = 'my-session-id'; | ||
// adTagDetailId = 'my-ad-tag-detail-id'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function getLiveAdTagDetail() { | ||
// Construct request | ||
const request = { | ||
name: stitcherClient.liveAdTagDetailPath( | ||
projectId, | ||
location, | ||
sessionId, | ||
adTagDetailId | ||
), | ||
}; | ||
const [adTagDetail] = await stitcherClient.getLiveAdTagDetail(request); | ||
console.log(`Live ad tag detail: ${adTagDetail.name}`); | ||
} | ||
|
||
getLiveAdTagDetail(); | ||
// [END video_stitcher_get_live_ad_tag_detail] | ||
} | ||
|
||
// node getLiveAdTagDetail.js <projectId> <location> <sessionId> <adTagDetailId> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sessionId) { | ||
// [START video_stitcher_get_live_session] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sessionId = 'my-session-id'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function getLiveSession() { | ||
// Construct request | ||
const request = { | ||
name: stitcherClient.liveSessionPath(projectId, location, sessionId), | ||
}; | ||
const [session] = await stitcherClient.getLiveSession(request); | ||
console.log(`Live session: ${session.name}`); | ||
} | ||
|
||
getLiveSession(); | ||
// [END video_stitcher_get_live_session] | ||
} | ||
|
||
// node getLiveSession.js <projectId> <location> <sessionId> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sessionId, adTagDetailId) { | ||
// [START video_stitcher_get_vod_ad_tag_detail] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sessionId = 'my-session-id'; | ||
// adTagDetailId = 'my-ad-tag-detail-id'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function getVodAdTagDetail() { | ||
// Construct request | ||
const request = { | ||
name: stitcherClient.vodAdTagDetailPath( | ||
projectId, | ||
location, | ||
sessionId, | ||
adTagDetailId | ||
), | ||
}; | ||
const [adTagDetail] = await stitcherClient.getVodAdTagDetail(request); | ||
console.log(`VOD ad tag detail: ${adTagDetail.name}`); | ||
} | ||
|
||
getVodAdTagDetail(); | ||
// [END video_stitcher_get_vod_ad_tag_detail] | ||
} | ||
|
||
// node getVodAdTagDetail.js <projectId> <location> <sessionId> <adTagDetailId> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright 2022, Google, Inc. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function main(projectId, location, sessionId) { | ||
// [START video_stitcher_get_vod_session] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// projectId = 'my-project-id'; | ||
// location = 'us-central1'; | ||
// sessionId = 'my-session-id'; | ||
|
||
// Imports the Video Stitcher library | ||
const {VideoStitcherServiceClient} = | ||
require('@google-cloud/video-stitcher').v1; | ||
// Instantiates a client | ||
const stitcherClient = new VideoStitcherServiceClient(); | ||
|
||
async function getVodSession() { | ||
// Construct request | ||
const request = { | ||
name: stitcherClient.vodSessionPath(projectId, location, sessionId), | ||
}; | ||
const [session] = await stitcherClient.getVodSession(request); | ||
console.log(`VOD session: ${session.name}`); | ||
} | ||
|
||
getVodSession(); | ||
// [END video_stitcher_get_vod_session] | ||
} | ||
|
||
// node getVodSession.js <projectId> <location> <sessionId> | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.