Alexa音频播放器指令-播放音频后讲话

时间:2020-11-11 16:55:04

标签: node.js alexa alexa-skills-kit alexa-voice-service alexa-sdk-nodejs

我正在尝试制作Alexa健身应用程序,当用户开始锻炼时,Alexa会解释锻炼内容,然后播放音频文件。然后,我想让Alexa解释第二个练习并播放下一个音频文件。重复执行约5个练习。

这是我的代码的一部分:

else if (slotValues.area.heardAs == 'lower body' || slotValues.area.heardAs == 'lower' || slotValues.area.heardAs == 'legs') {

say = 'Great choice! We will get started with an lower body workout. Let\'s begin with a warm-up. The first exercise is ' + lowerWorkout1[0].name + lowerWorkout1[0].description + ' 3. 2. 1.' ;

handlerInput.responseBuilder.addAudioPlayerPlayDirective('REPLACE_ALL', sLowerWorkout1.url, sLowerWorkout1.token, 0, null, sLowerWorkout1.metadata);
                // Then explain second exercise
                // Play the second audio
                // Then explain third exercise
                // Play the third audio
            }

/.../

 return responseBuilder
            .speak(say)
            //.reprompt('try again, ' + say)
            .getResponse();

我尝试在audioPlayerPlayDirective之后添加第二个say变量,但它仅输出第二个.speak(),然后播放第一个音频文件。我还试图在getResponse()之后添加另一个.speak(),但这给我一个错误。

有人对我该怎么做有任何想法吗?

谢谢

马丁

0 个答案:

没有答案