停止亚马逊 Alexa 音频输出

Stop Amazon Alexa audio output

我有一个 Alexa 技能意图使用以下代码输出 mp3:

intentName() {
  this.handler.state = states.SOMESTATE;
  this.response.audioPlayerPlay('REPLACE_ALL', audio.url, '1', null, 0);
}

我在 SOMESTATEnewSessionHandlers 处理程序中定义了以下内容:

'AMAZON.StopIntent' = function () {
  this.response.audioPlayerStop();
  this.emit(':responseReady');
}

但是当我说 'Alexa, stop' 时,上面定义的停止意图没有被调用。相反,正在调用 newSessionsHandlers 中的 Unhandled 意图。这是为什么?

我是个白痴,如果我在 newSessionHandlers.

中定义 ALEXA.PauseIntent 会有所帮助

根据 Alexa SDK:

"Note: In the above scenario, when your skill is not in an active session but is playing audio, or was the skill most recently playing audio, utterances such as 'stop' send your skill an AMAZON.PauseIntent instead of an AMAZON.StopIntent."

此处引用: https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html