首页 > 解决方案 > 无法在音频播放结束时添加 .listen() 指令

问题描述

就上下文而言,我正在构建一种将录制的旁白作为音频流的技能。

我的问题如下 - 作为技能的一部分需要音频播放,我使用的是AudioPlayerInterfaces. 我在以下部分遇到错误(请参见下面的代码和注释):

var audioEventHandlers = {
  'PlaybackStarted': function() {
    this.emit(':responseReady');
  },
  'PlaybackFinished': function() {
    if (currentStream.keyName === 'intro') {
      this.response.listen(); //<-- this line causes the error
    }
    this.emit(':responseReady');
  }, //additional handler code omitted as not relevant

具体来说,触发的错误this.response.listen()是:

"error": {
            "type": "INVALID_RESPONSE",
            "message": "The following directives are not supported: Response may not contain an reprompt,Response may not have shouldEndSession set to false"
        },

我看过其他技能使用录音,然后是.listen()提示,所以我知道这在技术上是可行的。我想知道我应该如何处理这个问题?

谢谢!

标签: alexaalexa-skills-kitalexa-skillalexa-app

解决方案


推荐阅读