Actions on Google: Audio Recorder Demo
This is a simple Assistant Action, built using Dialogflow, to playback an audio recording. The recording is made using a simple web app.
Setup Instructions
Before you begin
Make sure to perform these prerequisite steps:
- Install Firebase SDK Version
4.x.x
withnpm install --global firebase-tools@4.x.x
. - Select a project by running
firebase use --add
using aliasdefault
in the sample directory.
For troubleshooting these steps, you can refer to the latest setup instructions for Cloud Firestore.
Obtain the audio recorder libraries
Copy the following files from WebAudioRecorder.js into the public\javascript
folder:
- OggVorbisEncoder.min.js.mem
- WebAudioRecorder.min.js
- WebAudioRecorderOgg.min.js
Steps
- Click on the Add to Dialogflow button below and follow the prompts to create a new project:
- Click on the gear icon to see the
Project ID
in the settings. - Go to the Firebase console and select the project that was created.
- In the Database section, click Create database under
Cloud Firestore
. - Select Locked mode for the Cloud Firestore Security Rules and then click Enable.
- In the Authentication section, under the Sign in method tab, enable the Google sign-in method and click Save.
- Make sure
One account per email address
is set toPrevent creation of multiple accounts with the same email address
which should be selected by default.
- Make sure
- From the project overview page in the Firebase console, click Add Firebase to your web app.
- In the Database section, click Create database under
- Go to the command line to publish the project to Firebase Hosting:
- Run
firebase deploy
to deploy the project. - Take note of the hosting URL where the project has been published. It should look like
https://${PROJECT}.firebaseapp.com
- Run
- Test the audio recorder web app:
- Load the hosting URL in a browser.
- Click on the Google sign-in button to login into the web app.
- Click on the microphone button and give the browser permission to record audio.
- Say a few words and then click on the microphone button again to stop recording.
- In Dialogflow, on the left navigation menu in Dialogflow click on Fulfillment.
- Click on the Deploy button and wait for the deployment to complete.
- Select Integrations from the left navigation menu and open the Integration Settings menu for Actions on Google.
- Enable Auto-preview changes and Click Test. This will open the Actions on Google simulator.
- Type
Talk to my test app
in the simulator, or sayOK Google, talk to my test app
to any Actions on Google enabled device signed into your developer account.
For more detailed information on deployment, see the documentation.
References & Issues
- Questions? Go to StackOverflow, Assistant Developer Community on Reddit or Support.
- For bugs, please report an issue on Github.
- Actions on Google Documentation
- Actions on Google Codelabs.
- Webhook Boilerplate Template for Actions on Google.
Make Contributions
Please read and follow the steps in the CONTRIBUTING.md.
License
See LICENSE.
Terms
Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.