Reputation: 729
I was wondering if it was possible to not include text in my SSML, since my audio file says 'Are you ready to play?', I dont need any speech from the google assistant itself.
app.intent('Default Welcome Intent',(conv) =>{
const reply = `<speak>
<audio src="intro.mp3"></audio>
</speak>`;
conv.ask(reply);
});
The code above produces an error since I do not have any text input.
Upvotes: 1
Views: 288
Reputation: 7976
The other way to trick, try to use blank space to don't get No Response error (... is not responding now)
conv.ask(new SimpleResponse(" "))
const reply = `<speak>
<audio src="intro.mp3"></audio>
</speak>`;
conv.ask(reply);
Upvotes: 0
Reputation: 50731
The error you probably got was something like
expected_inputs[0].input_prompt.rich_initial_prompt.items[0].simple_response: 'display_text' must be set or 'ssml' must have a valid display rendering.
As it notes, there are conditions where the Assistant runs on a device with a display (such as your phone), and it should show a message that is substantively the same as what the audio plays.
You have a couple of options that are appropriate for these cases.
First, you can provide optional text inside the <audio>
tag that will be shown, but not read out (unless the audio file couldn't be loaded for some reason).
<speak>
<audio src="intro.mp3">Are you ready to play?</audio>
</speak>
Alternately, you can provide separate strings that represent the SSML version and the plain text version of what you're saying.
const ssml = `<speak><audio src="intro.mp3"></audio></speak>`;
const text = "Are you ready to play?";
conv.ask( new SimpleResponse({
speech: ssml,
text: text
}) );
Upvotes: 2
Reputation: 729
Found a hacky work around for this, By adding a very short string and then putting it in a prosody tag with a silent volume:
app.intent('Default Welcome Intent',(conv) =>{
const reply = `<speak>
<audio src="intro.mp3"></audio>
<prosody volume ="silent">a</prosody> </speak>`;
conv.ask(reply);
});
This plays the audio and does not speak the 'a' text.
Upvotes: 2