Play audio file from server
Asked Answered
S

1

9

I followed the steps to create a sample app and it is doing perfect conversation with my custom agent created.

Can we play our own music or MP3 hosted in my server by a voice message to Google Home? Or I need to play an audio from my Android app that is installed in Android device which is paired with Google Home by sending voice message to it?

Sterigma answered 5/4, 2017 at 13:26 Comment(0)
D
1

You can play audio files using the <speak>This is the audio <audio>link/or/url/to/audiofile.mp3</audio></speak> in your string response. You can find more details in the SSML section

Dreibund answered 6/4, 2017 at 16:51 Comment(3)
It's worth noting that if using a DNS address (as opposed to IP address), you need to use a globally-resolvable DNS record. (I.e. not something defined on your local DNS server) Devices like the Chromecast (and, I presume, Google Home) appear to ignore DHCP-provided DNS servers in favor of some hardcoded DNS server.Bier
I'm sorry, I don't follow!Dreibund
So, link/or/URL/to/audio file.mp3 might be something like http://192.168.7.9/my.file.mp3 or http://my.home.server.com/my.file.mp3. Both are fine. However, for the latter to work, my.home.server.com needs to exist in the global DNS somewhere. It's not enough to create a static DNS entry on your home router, as Google Home devices (if they operate the same way as Chromecasts) don't ask your home router to resolve DNS for them, but instead ask Google's DNS servers; they do this even if your home DHCP server instructs clients to use your home router for DNS resolution.Bier

© 2022 - 2024 — McMap. All rights reserved.