alexa-samples/skill-sample-nodejs-audio-player

How to read speak text before auto-playing the next enqueue stream?

ananddevsingh opened this issue · 3 comments

Hi Team,

I'm using the multiple-streams audio player and want the device to read the "output speech" before playing the audio while auto-playing the list. Same way the device is reading the "podcast.title" before playing the audio here

I've tried adding the "speak" in the response builder here something like:

responseBuilder.speak('Playing next audio').addAudioPlayerPlayDirective( playBehavior, podcast.url, enqueueToken, offsetInMilliseconds, expectedPreviousToken, );

but, it is throwing below error that clearly says it is not supported. I just want to know if there is any workaround.

"request": { "type": "System.ExceptionEncountered", "requestId": "amzn1.echo-api.request.68e6eafe-dbc2-40ae-823f-acd2296e2393", "timestamp": "2018-09-06T09:13:05Z", "locale": "en-IN", "error": { "type": "INVALID_RESPONSE", "message": "The following directives are not supported: Response may not contain an outputSpeech" }, "cause": { "requestId": "amzn1.echo-api.request.03eadbf7-e4e3-4bc1-8bb3-67b66c0e45a5" } }

Hi @sebsto, please suggest me on the same. Thanks.

This is not possible and documented here https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#playbacknearlyfinished

The Response to PlayBackNearlyFinished event can not include any text content. This makes sense as the skill is likely to be out of session when the event is triggered and we don't want customers to be surprised with Alexa starting to speak out of the blue when an audio track is almost finished.

Thanks for the clarification.