简体   繁体   English

将音乐添加到对话流

[英]Add music to dialogflow

I am trying to add music into my dialogflow agent.我正在尝试将音乐添加到我的 dialogflow 代理中。 I don't want to add it from the dialogflow console and I wish to add it from the webhook.我不想从 dialogflow 控制台添加它,我希望从 webhook 添加它。 Can you please tell me how to add the music from the webhook.你能告诉我如何从 webhook 添加音乐吗? I am trying this code but it's not working:我正在尝试此代码,但它不起作用:

app.intent('Music', (conv) => {
    var speech = '<speak><audio src="soundbank://soundlibrary/ui/gameshow/amzn_ui_sfx_gameshow_countdown_loop_32s_full_01"/>Did not get the audio file<speak>';
});

Also I want to use one interrupt keyword which will stop this music, is there any predefined way or if user defined, how to interrupt the music and proceed with my other code?此外,我想使用一个中断关键字来停止此音乐,是否有任何预定义的方式或如果用户定义,如何中断音乐并继续我的其他代码?

Firstly, to be able to add music, it needs to be hosted on a publicly accesible https endpoint, see the docs .首先,为了能够添加音乐,它需要托管在可公开访问的 https 端点上,请参阅文档 So make sure you can access your file even when using a private browsing mode such as incognito on chrome.因此,即使在 chrome 上使用隐身浏览模式(例如隐身模式),也要确保您可以访问您的文件。

Secondly, If you choose to use SSML to play your audio, the audio will become part of the speech response.其次,如果您选择使用 SSML 播放您的音频,音频将成为语音响应的一部分。 By doing this, you won't be able to create any custom interruptions or control over the music.通过这样做,您将无法创建任何自定义中断或控制音乐。 The user can only stop the music by stopping your action or saying "Okay Google" again to interrupt your response.用户只能通过停止您的操作或再次说“好的谷歌”来中断您的响应来停止音乐。

If you would want to allow your users to control the music you send to them, try having a look at the media responses within the actions on google library.如果您想让您的用户控制您发送给他们的音乐,请尝试查看谷歌库上操作中的媒体响应

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM