alexa-js / alexa-app

A framework for Alexa (Amazon Echo) apps using Node.js
https://www.youtube.com/watch?v=pzM4jv7k7Rg
MIT License
1.03k stars 212 forks source link

audioplayer res.say("X"); doesn't make alexa speak #132

Open getarobo opened 7 years ago

getarobo commented 7 years ago

Hi, I am trying make alexa say something after audio player is finished. Bottom code doesn't make alexa say "Would you like to hear more?" but it does log '[AUDIO] PlaybackFinished ask for more' on lamba.

Am I doing this wrong?

app.audioPlayer('PlaybackFinished', function( req, res){ audioStateIs = 'PlaybackFinished'; console.log('[AUDIO] PlaybackFinished ask for more'); isNextPodcast = true; res.say("Would you like to hear more?").shouldEndSession(false);

});

dblock commented 7 years ago

I would examine the JSON/SSML that comes out of this function and see if all the parts are there for a start.

getarobo commented 7 years ago

Is there some function to examine the JSON/SSML? Thanks!

dblock commented 7 years ago

Just use curl against your local web service. If you're using lambda you can use apex. I talked about both of those in http://artsy.github.io/blog/2016/11/30/bringing-artsy-to-amazon-echo-alexa/, that could be helpful.

Also maybe we should add some instructions for this either for this project or https://github.com/alexa-js/alexa-app-server, appreciate any PRs.

getarobo commented 7 years ago

Awesome <3, I was looking for these~~~

getarobo commented 7 years ago

Looking in to this, how can i send "AudioPlayer Requests"? Alexa-app-server has launch, intent, sessionended.

dblock commented 7 years ago

If you're talking about the test UI I bet it's not supported, those were just added in https://github.com/alexa-js/alexa-app/pull/92. So curl and friends. But would appreciate PRs for anything that helps the next person.

fremail commented 7 years ago

I am trying make alexa say something after audio player is finished.

That's not possible. Check Amazon doc:

Note: When responding to AudioPlayer requests, you can only respond with AudioPlayer directives. The response cannot include any of the standard properties such as outputSpeech. In addition, some requests limit the directives you can use, such as not allowing Play. Sending a response with unsupported properties causes an error. See the request types below for the limits on each request.

dblock commented 7 years ago

@fremail Thanks! I think we could throw an error when you try to do both audioplayer and say, couldn't we? I see a nice PR opportunity here ...

fremail commented 7 years ago

@dblock You can do both AudioPlayer and say on Launch and Intent requests, but can't do say on AudioPlayer requests.

Actually, Alexa-app has a more global issue - it does say on exception.

dblock commented 7 years ago

Right. Would you at least open an issue on the latter @fremail? Thx.

fremail commented 7 years ago

@dblock done! See #135

dblock commented 7 years ago

Thanks @fremail, all we need now is a fix ;)

dblock commented 7 years ago

So... aside of exceptions, do we need to throw an error inside audioplayer requests when we do say?

fremail commented 7 years ago

Yeah, we need it. But I'm not sure when I have time to implement this feature.