gpt4 book ai didi

node.js - Alexa-音频问题

转载 作者:太空宇宙 更新时间:2023-11-04 02:10:57 25 4
gpt4 key购买 nike

var Response = require('alexa-response');

//first intent
LaunchRequest:function(){
//Type 1 gives an error saying the "response is not valid" when tested in the developers console.
//the Response here is an npm library
Response.directives(
AudioPlayer.play({ url: 'https://s3.amazonaws.com/sounds226/boom.mp3' }),
AudioPlayer.enqueue({ url: 'https://s3.amazonaws.com/sounds226/boom.mp3' } ) .build();

//Type 2 : gives an error when tested on echosim.io saying that the response is not valid
speechOutput = this.t('WELCOME_MESSAGE'); this.response.audioPlayerPlay("REPLACE_ALL",audioData[1].url).speak(speechOutput);
this.emit(':responseReady');

//Type 3: tried to insert the audio tag within the speech response, error again
speechOutput = {
speech: "<speak>" +message+ "<audio src = 'https://s3.amazonaws.com/sounds226/boom.mp3'/></speak>",
type : 'SSML'
};
response.ask(speechOutput);
}

我正在尝试在 Alexa 说出我的技能之前插入音频。音频在 90 秒之内。是我对音频标签的理解错误还是以错误的方式使用了指令?先感谢您。感谢任何帮助

最佳答案

以下是示例介绍:

https://developer.amazon.com/blogs/post/Tx1DSINBM8LUNHY/new-alexa-skills-kit-ask-feature-audio-streaming-in-alexa-skills

并且有明确的信息:

响应 LaunchRequest 或 IntentRequest 时,您的响应可以包含 AudioPlayer 指令和标准响应属性,例如 outputSpeech、card 和 reprompt。 例如,如果您在与 Play 指令相同的响应中提供 outputSpeech,Alexa 将在开始传输音频之前朗读所提供的文本。

文档 - https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference

有关开始播放的更多信息

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference#play

关于node.js - Alexa-音频问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42147440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com