语音功能在 IFrame 中不起作用

Sri*_*san 1 speech-recognition botframework azure-cognitive-services

我有一个机器人客户端,我在其中启用了语音功能。当我在新窗口中打开机器人客户端时,一切正常。最近,我们在页面中添加了此机器人客户端站点 URL 作为 IFrame。在此情况下,除语音功能外,所有功能都运行良好。当我们单击麦克风图标时,没有任何反应。

已在多种浏览器和设备中尝试过,所有设备中都有同样的问题。Windows - Chrome、IE iPad、iPhone

这是预期的行为吗?或者我需要更新什么吗?

如果您希望我分享任何代码,请告诉我。

代码。

 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');
        });
Run Code Online (Sandbox Code Playgroud)

mdr*_*son 5

为了使语音能够与 WebChat 一起使用,您需要执行一些操作。

  1. 确保您没有使用带有来自 Azure 门户的嵌入代码的 WebChat 版本。您必须使用WebChat 捆绑包之一(如果您希望它在 IE 中工作,请使用 es5 捆绑包之一)

  2. 许多版本的主要浏览器都不支持语音服务。确保您和您的用户仅使用支持的浏览器或使用 Bing Speech

  3. Chrome(将来可能还有其他浏览器)会阻止麦克风访问,直到页面/iFrame 上首先发生某些交互。你应该能够解决这个问题<iframe allow="microphone *">