Two Minute Actions: Long-running Audio
In this “Two Minute Actions” series, we take an idea and explain how to implement it as an Action for the Google Assistant using the powerful features of Actions on Google.
Don’t let the summer end by enjoying long-running beach sounds. You can do this by playing hours of audio on your smart speaker.
We need a way to play longer duration audio on a smart speaker. Actions on Google has a media player that allows you to play audio files.
For content, you can find thousands of free sounds in the Actions sound library. We recommend trying some of the ambient sounds. Then, you can combine these audio tracks to make them long enough by using a free audio editor like Audacity or a utility like SoX. These tracks can be hosted online with services like Cloud Storage for Firebase.
If you want to create a playlist of audio tracks, the Actions on Google media player has a unique feature that invokes a callback after playback completion using the ‘actions.intent.MEDIA_STATUS’ intent. You can use this to invoke another player to play the next track in the list.
To trigger the Action, a user can just invoke the Action by name. Even better, the Google Assistant recently added a new feature that allows users to schedule routines. It’s easy to design your Action with a triggering intent, which is invoked when the user executes their routine. Use the Actions Console to configure your action for automatic routine suggestions.
A good starting point for this Action is building one of our sample Actions. Just click on this link and within a minute you will have a working Dialogflow agent with fulfillment code to play media that you can extend to make this Action.
Want More? Head over to the Actions on Google community to discuss Actions with other developers. Join the Actions on Google developer community program and you could earn a $200 monthly Google Cloud credit and an Assistant t-shirt when you publish your first app.