Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Actions sdk not playing audio in ssml from firebase storage

Google Actions SDK is unable to play audio files in SSML Audio tag from firebase storage. Although I could play same .ogg format file from wikipedia. https://upload.wikimedia.org/wikipedia/en/9/9f/Sample_of_%22Another_Day_in_Paradise%22.ogg

firebase file: https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&token=d0d08f9d-e340-478c-af00-657109683136

I'm using it by sending an SSML string that looks like:

<speak>
  <audio src='https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&token=d0d08f9d-e340-478c-af00-657109683136'>
  </audio>
</speak>

But I'm getting the following error:

expected_inputs[0].input_prompt.rich_initial_prompt.items[0].simple_response: 'ssml' could not be parsed.

What could be the reason...Is this a limitation in actions sdk that url needs to be parameter free?

like image 522
Praggie Avatar asked May 26 '17 16:05

Praggie


1 Answers

The problem isn't that it can't use parameters - it is that when parsing parameters in URLs that are embedded in SSML it doesn't parse the & separating the parameters the way most HTML parsers parse them these days.

There are a few potential solutions for this, depending on how you can format the URL.

RFC 1866 used to recommend using a ; in place of an &, and some servers allow this. Unfortunately, Firebase Storage is not one of them.

Firebase Storage doesn't require the final token parameter in most cases, so in this case you could omit it, but that isn't a general solution to the problem.

Finally, you could use SGML encoding and replace the & as &amp; (note the leading ampersand and final semicolon). So your SSML would look something like:

<speak>
  <audio src='https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&amp;token=d0d08f9d-e340-478c-af00-657109683136'>
  </audio>
</speak>

This last method is probably the best for general purposes.

like image 180
Prisoner Avatar answered Nov 14 '22 20:11

Prisoner