botframework - Speech functionality not working in IFrame
问题描述
I have a bot client and in which I have enabled speech functionality. Everything works fine when I open the bot client in new window. Recently we have added this bot client site url in a page as IFrame. In this all the functionalities are working fine except speech functionality. When we are clicking on microphone icon nothing is happening.
Have tried in multiple browsers and devices, same issue in all the devices. Windows - Chrome, IE IPad, IPhone
Is it the expected behavior? or Do i need to update anything?
Please let me know if you want me to share any code.
Code.
speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({
subscriptionKey:
'xxx'
}),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: 'xxx'
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)'
})
};
BotChat.App({
botConnection: botConnection,
user: { id: model.userId, Username: LoginUser,},
bot: { id: model.botId, name: model.botName },
resize: 'window',
speechOptions: speechOptions,
locale: 'en',
sendTypingIndicator: true
}, document.getElementById('BotChatElement'));
botConnection
.postActivity({
from: user,
name: 'requestWelcomeDialog',
type: 'event',
value: ''
})
.subscribe(function (id) {
console.log('"trigger requestWelcomeDialog" sent');
});
解决方案
为了让语音与 WebChat 一起工作,您需要做一些事情。
确保您没有使用带有 Azure 门户中嵌入代码的 WebChat 版本。您必须使用WebChat 包之一(如果您希望它在 IE 中工作,请使用 es5 包之一)
许多版本的主要浏览器不支持语音服务。确保您和您的用户仅使用受支持的浏览器或使用必应语音
Chrome(以及未来可能的其他浏览器)会阻止麦克风访问,直到某些交互首先在 page/iFrame 上发生。你应该能够解决这个问题
<iframe allow="microphone *">
推荐阅读
- html - 网格布局内的中心列
- bash - 从 bash 脚本发送电子邮件
- android - 在 Android 特定代码中访问 Sqflite
- jar - jar tvf:仅前两个级别
- python - 如何在 django 视图中返回 mp3 文件
- javascript - 为什么客户端文件被称为静态文件而服务器端文件不是?
- postgresql - 使用 EXECUTE 时 Postgres 10 和格式错误的数组文字
- vb.net - 具有未知文件扩展名(但已知名称)的文件的 VB.NET 路径
- python - 网页抓取基于 Javascript 的表格
- discord - 删除命令或“触发词”消息