Google Actions sdk not playing audio in ssml from firebase storage

血红的双手。 提交于 2019-12-01 03:53:20

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44206436/google-actions-sdk-not-playing-audio-in-ssml-from-firebase-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!