Skip to content

Latest commit

 

History

History

video-hint-end

Video hint - completed code

Get a brief description of a video using the Google Cloud Video Intelligence API.

video-hint-final.mp4

To run with a real firebase project (recommended)

Run these commands in your terminal:

  1. Navigate to this web app folder and install dependencies:
cd video-hint-end
npm install
(cd functions && npm install)
  1. Specify which project Firebase should use:
firebase use <name-of-your-project>
# For example: firebase use codelab-ai-extensions
  1. Enable the web frameworks experiment:
firebase experiments:enable webframeworks
  1. Initialize Firebase hosting:
firebase init hosting

Use default options for all prompts.

  1. Deploy the Firestore and Cloud Storage Security Rules:
firebase deploy --only firestore:rules,storage
  1. Deploy the Cloud Functions in the functions folder:
firebase deploy --only functions
  1. An Extensions Manifest is already provided for you in this folder. However you need to edit the extensions/storage-label-videos.env file with your actual bucket name:
INPUT_VIDEOS_BUCKET=<your-bucket-name>
OUTPUT_BUCKET=<your-bucket-name>
  1. You also need to edit the extensions/text-to-speech.env file with your actual bucket name:
BUCKET_NAME=<your-bucket-name>
  1. To deploy the extensions used in this web app, run this command in your terminal:

Note: If you are asked Would you like to delete any other extensions, select No.

firebase deploy --only extensions
  1. Edit the lib/firebase/firebase-config.js file with your Firebase configuration.

  2. Back in your terminal, run the web app:

firebase emulators:start --only hosting
  1. Open http://localhost:5000/ in your browser (or whatever URL is presented to your in your terminal) to see the result.

To run locally with local emulators (not recommended)

This has no AI functionality.

This is only useful for codelab authors, or learners who are unable to use a real Firebase project or real Google Cloud services.

  1. In your terminal, navigate to this web app folder:
cd video-hint-end
  1. Replace the .env.development file with these contents:
NEXT_PUBLIC_IS_TEST_MODE=true
  1. Run this command in your terminal:
export NEXT_PUBLIC_IS_TEST_MODE=true
  1. In the same terminal session from the previous step, run this command:
firebase emulators:start --project demo-codelab-video-hint
  1. Edit the lib/firebase/firebase-config.js file with your emulator configuration.

  2. In a new terminal tab, run these commands:

npm install
npm run dev
  1. Open http://localhost:3000/ in your browser to see the result.

Video credits

This repository includes videos that are useful for uploading to try out the Video Hint app. You can find sources for the videos in the ./lib/exampleVideos.js file.