我正在尝试让Alexa播放我存储在公共的AWS S3存储桶中的mp3文件。当我尝试触发其他意图时,一切都会正常进行,但是当我使用音频文件触发一个意图时,它将触发错误意图:
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'
}
];
谢谢!