Amazon web services 尝试返回mp3文件时出现Alexa skill错误
我试着让Alexa播放一个mp3文件,我把它存储在AWS S3的公共存储桶中。当我尝试触发其他意图时,一切正常,但当我触发带有音频文件的意图时,它会触发错误意图:Amazon web services 尝试返回mp3文件时出现Alexa skill错误,amazon-web-services,aws-lambda,aws-sdk,alexa,alexa-skills-kit,Amazon Web Services,Aws Lambda,Aws Sdk,Alexa,Alexa Skills Kit,我试着让Alexa播放一个mp3文件,我把它存储在AWS S3的公共存储桶中。当我尝试触发其他意图时,一切正常,但当我触发带有音频文件的意图时,它会触发错误意图: Sorry, I can't understand the command. Please say again. Index.js文件: const PlayTheThreePiggletsIntentHandler = { canHandle(handlerInput) { return handlerIn
Sorry, I can't understand the command. Please say again.
Index.js文件:
const PlayTheThreePiggletsIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'PlayThreePigletsIntent';
},
handle(handlerInput) {
const song = constants.audioData;
return handlerInput.addAudioPlayerPlayDirective('REPLACE_ALL', song[1].url, '0', 10)
.withShouldEndSession(true)
.getResponse();
}
};
constants.js:
exports.audioData = [
{
title: 'Gods plan',
url: 'https://s3-eu-west-1.amazonaws.com/kinderverhalen-template/tale2.mp3'
},
{
title: 'The Three Piglets',
url: 'https://s3-eu-west-1.amazonaws.com/kinderverhalen-template/tale.mp3'
}
];
提前谢谢 错误意图是否接收实际错误作为其第二个参数,并使用
console.log()
?@Michael sqlbot将其写入Lambda日志?您是对的。给出了以下错误消息:“handlerInput.AddAudioPlayerPlayerDirective不是函数”。知道为什么吗?显然我忘了在handlerInput文件后添加“responseBuilder”。。。现在工作请在下面贴出答案,并更改代码。。。为了未来游客的利益。