所以,在我讨论问题之前,我已经看过this了。基本上我所要做的只是播放一些音频,当音频完成时,我只想让Alexa向用户询问一些东西。就是这样。当我尝试发出:ask
时,我得到The following directives are not supported: Reponse may not contain an output speech, Response may not have shouldEndSession set to false
好的,我上面发布的SO链接是我在谷歌搜索后发现的。老实说绝对没有办法让Alexa在音频结束后说/问什么?如果是这样,这绝对是荒谬的,那有什么办法吗?
这是我的相关代码:
'PlaybackFinished' : function() {
console.log('The stream comes to an end');
//here lets get the name, and start scenario 3.
this.emit('PostMissionRequest');
},
'PostMissionRequest': function() {
var db = new AWS.DynamoDB.DocumentClient();
var params = {
TableName: "ALP-Infusion-Adventures",
Key: {
"UIUD": "1"
}
};
var self = this;
this.response.speak('Stream ended').audioPlayerStop();
db.get(params, function(err, data) {
if (err) {
...
} else {
console.log("GetItem succeeded! Results:", JSON.stringify(data, null, 2));
var res = data.Item;
self.response.speak('this is a test');
self.emit(':ask', `Nice job completing your mission, ${res.UName}! Would you like to plan your next mission?`)
self.emit(':responseReady');
}
});
},
答案 0 :(得分:0)
根据documentation,您不能,但是可以让您希望Alexa发言的MP3入队。就您而言,您可以不用录制this.response.speak('Stream ended')
的MP3录音,而将其放入PostMissionRequest
处理程序中