Alexa custom skill - взаимодействуйте с другими навыками - PullRequest
0 голосов
/ 28 октября 2019

Я бы хотел сыграть определенную песню особым образом.

 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
    }

Можете ли вы обратиться ко мне с соответствующей документацией, если это возможно. Спасибо.

1 Ответ

0 голосов
/ 06 ноября 2019

Я нашел решение:

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