To be very clear I want to know how to add audio from firebase storage in actions on Google? I've been stuck in this question since few weeks. I've uploaded my audio in the firebase storage and from it I have copied the link provided by Firebase and and pasted the audio's URL in the given format in speech output. Check how I did:-
<speak>
<audio src="https://firebasestorage.googleapis.com/v0/b/enrich-58fdf.appspot.com/o/xxx.mp3?alt=media&token=aabcd430-9d46-45f6-ad21-fdca0895123f">
</audio>
</speak>
But this didn't work. But few months ago in the Google+ community, I found a guy who asked the question similar to this and Allen Firstenberg replied and he said to add *amp;*token between & and token. So after this, a new code generates i.e.
<speak>
<audio src="https://firebasestorage.googleapis.com/v0/b/enrich-58fdf.appspot.com/o/xxx.mp3?alt=media&token=aabcd430-9d46-45f6-ad21-fdca0895123f">
</audio>
</speak>
But this also didn't work. I think after some tweaks in SSML, this code might have changed or the format is different, which I am not aware of. So can anyone help me out ?
See the Firebase Hosting get started guide for more information. If you are an existing Firebase user, you can also easily re-use any assets you have hosted for your mobile or web apps. Check out this sample which uses Firebase Hosting and learn more about how this can be used to host your Action files, by visiting our Firebase Hosting docs.
On the server, you can use Google Cloud Storage APIs to access the same files. Firebase SDKs for Cloud Storage perform uploads and downloads regardless of network quality. Uploads and downloads are robust, meaning they restart where they stopped, saving your users time and bandwidth.
Using Firebase and Google Ads together Firebase is Google’s app software development kit (SDK) and analytics tool. To import your Firebase conversions to Google Ads, you can either link your Google Analytics 4 property or your Firebase project to Google Ads.
Tune in to learn how Firebase can help you accelerate app development, release with confidence, and scale with ease. Register Cloud Storage for Firebase allows you to quickly and easily upload files to a Cloud Storage bucket provided and managed by Firebase.
Try escaping the &
by replacing&
with &
.
If you're still having trouble try adding some text between the </audio>
tag and the </speak>
tag. Actions on Google requires that both display text and SSML or SSML to be able to be visually represented. Adding text in the SSML will allow your SSML to be rendered visually as well as audibly.
Below is a fulling working SSML string using Firebase storage using both the above mentioned techniques:
<speak>
<audio src="https://firebasestorage.googleapis.com/v0/b/repeater-96d05.appspot.com/o/digital_watch_alarm_long.ogg?alt=media&token=cdf4d1da-1d1f-42eb-a478-3912275d0f37">
</audio>
text
</speak>
As both you and @matthewayne noted (and as I noted in a different answer you reference), you need to escape the &
to use proper XML formatting, so it needs to be &
However - I don't see a problem. I used this exact code in the Dialogflow "Text Response" area, and it works without problems:
<speak><audio src="https://firebasestorage.googleapis.com/v0/b/enrich-58fdf.appspot.com/o/welcome.mp3?alt=media&token=aabcd430-9d46-45f6-ad21-fdca0895123f"></audio></speak>
I've also tested this as part of a Simple Response setting through Dialogflow, and it works fine.
FWIW: Are you sure that your audio files have been recorded with an acceptable format? I had to use a tool called Audacity to convert some audio clips I had to one of the formats acceptable to the AoG platform:
Format: MP3 (MPEG v2) 24K samples per second 24K ~ 96K bits per second, fixed rate
Format: Opus in Ogg 24K samples per second (super-wideband) 24K - 96K bits per second, fixed rate
Format (deprecated): WAV (RIFF) PCM 16-bit signed, little endian 24K samples per second
For all formats: Single channel is preferred, but stereo is acceptable. 120 seconds maximum duration. 5 megabyte file size limit. Source URL must use HTTPS protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With