【发布时间】:2019-04-03 20:54:21
【问题描述】:
我正在关注this link,我们可以在其中使用机器人框架中的语音识别。
默认代码使用选项2,
// // Option 2: Native browser speech (not supported by all browsers, no speech recognition priming support)
//
// Note that Chrome automatically blocks speech if the HTML file is loaded from disk. You can run a server locally
// or launch Chrome (close all the existing Chrome browsers) with the following option:
// chrome.exe --allow-file-access-from-files <sampleHtmlFile>
//
const speechOptions = {
speechRecognizer: new BotChat.Speech.BrowserSpeechRecognizer(),
speechSynthesizer: new BotChat.Speech.BrowserSpeechSynthesizer()
};
但是当我尝试使用认知服务时它不起作用,这意味着麦克风无法进入聆听模式。
这是我所做的更改,
// // Option 3: Cognitive Services speech recognition using API key (cross browser, speech priming support)
const speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({ subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY' }),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY',
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
})
};
除了评论和取消评论我没有做任何事情。但代码仍然只适用于 Option 2
请帮我解决这个问题
【问题讨论】:
-
有一个与此线程相关的类似问题 - github.com/Microsoft/BotFramework-WebChat/issues/687 请检查它是否有帮助。
-
@MohitVerma-MSFT 感谢您的链接。我认为这与该问题无关,因为我尝试了几乎所有浏览器,如 Chrome、Firefox 和 Edge,因为认知可以在跨平台浏览器中工作。我厌倦了所有不同的。当我单击麦克风图标时,它们都不起作用,浏览器得到结构并在任何浏览器中都没有进入监听模式。
标签: javascript azure speech-recognition microsoft-cognitive azure-bot-service