roboGOD
roboGOD

Reputation: 56

How to play live audio stream using Google Actions Dialogflow

I have been trying to find a way to play live stream of audio (mp3) using Google Actions but haven't found a way to do so.

I tried Media Response as well but as mentioned in the documentation it doesn't support live stream.

I followed this thread but it doesn't have any examples to help me with.

Is it possible to play live mp3 stream using Google Actions?

Upvotes: 0

Views: 102

Answers (1)

Prisoner
Prisoner

Reputation: 50731

I've had relatively good results with the Media Player being able to handle mp3 "streams". There are a couple of problems doing this, however:

  • There is a time limit on the audio playback (4 hours last time I checked, but it may have changed).
  • There isn't any such thing as an mp3 "stream". The player treats it as a single mp3 file that it downloads in chunks using HTTP headers, unlike some of the streaming protocols that allow for varying bitrate based on network and other conditions.

If this is an issue, one alternative might be to use the Interactive Canvas (which uses Chrome on the device) to present an HTML page that has an <audio> tag in it that you control. This gives you a little more control (most streaming protocols are either supported or have JavaScript libraries that can do the work), but there are some downsides:

  • This will only work on Smart Displays and Android. Smart Speakers aren't supported.
  • Interactive Canvas is only allowed for certain types of Actions. Currently it must be a game, a story, or an educational Action.

Upvotes: 1

Related Questions