【问题标题】:Alexa custom skill - interact with other skillsAlexa 自定义技能 - 与其他技能交互
【发布时间】:2020-02-23 13:31:47
【问题描述】:

我想以特定的方式播放一首特别的歌曲。

 let speechText = ``;//Happy ${currentYear - year}th birthday!`;
    if (currentDate.getTime() !== nextBirthday.getTime()) {
        if(currentDate.getTime() > nextBirthday.getTime()){
            speechText = `Ciao Alberto! Hai già festeggiato il tuo compleanno quest'anno!!, Ti sei divertito?`;
        } else {
            const diffDays = Math.round(Math.abs((currentDate.getTime() - nextBirthday.getTime())/oneDay));
            speechText = `Ciao Alberto! Mancano ${diffDays} giorni al tuo primo compleanno!! Sei emozionato?`;
            //speechText = `Welcome back. It looks like there are ${diffDays} days until your ${currentYear - year}th birthday.`
        }
    } else {
        // PLAY THAT SONG
    }

如果可能的话,你能在正确的文档上给我打电话吗? 谢谢。

【问题讨论】:

  • “特定方式”是什么意思?你想在某人生日的时候播放一首歌吗?
  • 是的,我想在 ELSE 语句中播放一首歌(“生日快乐”)。

标签: aws-lambda spotify alexa-skills-kit alexa-skill


【解决方案1】:

我找到了解决办法:

else{
        expectedPreviousToken = 'sometoken' + Math.random();
        return handlerInput.responseBuilder
            //.speak('start playing sound')
                .addAudioPlayerPlayDirective('REPLACE_ALL', podcastURL, expectedPreviousToken, 0, null)
                 .withSimpleCard('Example', 'Example')
                 .getResponse();}

【讨论】:

    猜你喜欢
    • 2017-06-15
    • 2018-12-31
    • 1970-01-01
    • 2018-11-04
    • 2017-08-28
    • 1970-01-01
    • 1970-01-01
    • 2017-07-23
    • 2018-12-03
    相关资源
    最近更新 更多