停止音频行动退出

问题描述 投票:0回答:1

所以,我的应用程序包含来自一个意图无尽的播放。我想,当我退出的意图,回放应该停止。目前,当我退出该应用程序关闭,但声音不断播放。我曾尝试用小叮当的声音来修补它,但它抛出一个错误这样。有没有一种方法存在之前停止音乐吗?

Typical conversation looks like following:
Person: Hey google, talk to my test app
Google: Hey welcome to audio station (plays audio).
Person: Hey google, stop the app.
Google: App exits (echo sound) (Audio keeps on playing).

此代码是当谷歌播放音乐

conv.ask(new MediaObject({
    name: track.name,
    url: track.URL, // This is a URL from our server, playing music
    description: track.description,
    icon: new Image({
        url: track.pic ? track.pic : defaultImageURL,
        alt: 'Media icon'
    });

而下面的代码是退出的操作:

conv.close('Bye bye');
dialogflow actions-on-google
1个回答
-1
投票
while waiting for response can sleep


while (!response.isDone()) {
  System.out.println("Waiting for response...");
  Thread.sleep(10000);
}

或者获取结束时间

    System.out.printf(
        "\t%s.%s sec - %s.%s sec\n",
        wordInfo.getStartTime().getSeconds(),
        wordInfo.getStartTime().getNanos() / 100000000,
        wordInfo.getEndTime().getSeconds(),
        wordInfo.getEndTime().getNanos() / 100000000);
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.