Skip to content

Commit

Permalink
docs: update Transcoder API samples to v1 (#99)
Browse files Browse the repository at this point in the history
* feat: update Transcoder API samples to v1

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Address feedback.

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: sofisl <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2021
1 parent da6ca41 commit 76a98ab
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 62 deletions.
25 changes: 14 additions & 11 deletions media/transcoder/createJobFromAdHoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function main(projectId, location, inputUri, outputUri) {
// outputUri = 'gs://my-bucket/my-output-folder/';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -43,21 +44,23 @@ function main(projectId, location, inputUri, outputUri) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
key: 'video-stream1',
videoStream: {
codec: 'h264',
heightPixels: 720,
widthPixels: 1280,
bitrateBps: 2500000,
frameRate: 60,
h264: {
heightPixels: 720,
widthPixels: 1280,
bitrateBps: 2500000,
frameRate: 60,
},
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/createJobFromPreset.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function main(projectId, location, inputUri, outputUri, preset) {
// preset = 'preset/web-hd';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/createJobFromTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function main(projectId, location, inputUri, outputUri, templateId) {
// templateId = 'my-job-template';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
25 changes: 14 additions & 11 deletions media/transcoder/createJobTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, templateId) {
// templateId = 'my-job-template';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -41,21 +42,23 @@ function main(projectId, location, templateId) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
key: 'video-stream1',
videoStream: {
codec: 'h264',
heightPixels: 720,
widthPixels: 1280,
bitrateBps: 2500000,
frameRate: 60,
h264: {
heightPixels: 720,
widthPixels: 1280,
bitrateBps: 2500000,
frameRate: 60,
},
},
},
{
Expand Down
14 changes: 8 additions & 6 deletions media/transcoder/createJobWithAnimatedOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function main(projectId, location, inputUri, overlayImageUri, outputUri) {
// outputUri = 'gs://my-bucket/my-output-folder/';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -44,11 +45,12 @@ function main(projectId, location, inputUri, overlayImageUri, outputUri) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
Expand Down
14 changes: 8 additions & 6 deletions media/transcoder/createJobWithPeriodicImagesSpritesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function main(projectId, location, inputUri, outputUri) {
// outputUri = 'gs://my-bucket/my-output-folder/';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -43,11 +44,12 @@ function main(projectId, location, inputUri, outputUri) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
Expand Down
14 changes: 8 additions & 6 deletions media/transcoder/createJobWithSetNumberImagesSpritesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function main(projectId, location, inputUri, outputUri) {
// outputUri = 'gs://my-bucket/my-output-folder/';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -43,11 +44,12 @@ function main(projectId, location, inputUri, outputUri) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
Expand Down
14 changes: 8 additions & 6 deletions media/transcoder/createJobWithStaticOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function main(projectId, location, inputUri, overlayImageUri, outputUri) {
// outputUri = 'gs://my-bucket/my-output-folder/';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand All @@ -44,11 +45,12 @@ function main(projectId, location, inputUri, overlayImageUri, outputUri) {
{
key: 'video-stream0',
videoStream: {
codec: 'h264',
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 550000,
frameRate: 60,
},
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/deleteJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, jobId) {
// jobId = 'my-job-id';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/deleteJobTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, templateId) {
// templateId = 'my-job-template';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/getJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, jobId) {
// jobId = 'my-job-id';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/getJobState.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, jobId) {
// jobId = 'my-job-id';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/getJobTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function main(projectId, location, templateId) {
// templateId = 'my-job-template';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/listJobTemplates.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function main(projectId, location) {
// location = 'us-central1';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/listJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function main(projectId, location) {
// location = 'us-central1';

// Imports the Transcoder library
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;

// Instantiates a client
const transcoderServiceClient = new TranscoderServiceClient();
Expand Down
3 changes: 2 additions & 1 deletion media/transcoder/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ async function main(projectId, location) {
*/
// const projectId = 'my-project';
// const location = 'us-central1';
const {TranscoderServiceClient} = require('@google-cloud/video-transcoder');
const {TranscoderServiceClient} =
require('@google-cloud/video-transcoder').v1;
const client = new TranscoderServiceClient();
async function listJobs() {
const [jobs] = await client.listJobs({
Expand Down
17 changes: 11 additions & 6 deletions media/transcoder/test/transcoder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@ after(async () => {
describe('Job template functions', () => {
before(() => {
// Delete the job template if it already exists
execSync(
`node deleteJobTemplate.js ${projectId} ${location} ${templateId}`,
{
cwd,
}
);
try {
execSync(
`node deleteJobTemplate.js ${projectId} ${location} ${templateId}`,
{
cwd,
}
);
} catch (err) {
// ignore not found error
}

const output = execSync(
`node createJobTemplate.js ${projectId} ${location} ${templateId}`,
{cwd}
Expand Down

0 comments on commit 76a98ab

Please sign in to comment.