Botframework 将语音设置为';欧洲标准GB';使用WebSpeechAPI和webSpeechPonyfillFactory

Botframework 将语音设置为';欧洲标准GB';使用WebSpeechAPI和webSpeechPonyfillFactory,botframework,webspeech-api,Botframework,Webspeech Api,我正试图在webSpeechPonyfillFactory中将SpeechSynthesisVoice设置为en GB,并将性别设置为女性,如示例所示 我不擅长ponyfill,我尝试将价值传递给工厂,但失败了 async createPonyfillFactory(){ const webSpeechPonyfillFactory=wait window.WebChat.createBrowserWebSpeechPonyfillFactory(); 返回选项=>{ const webSpee

我正试图在
webSpeechPonyfillFactory
中将
SpeechSynthesisVoice
设置为en GB,并将性别设置为女性,如示例所示

我不擅长ponyfill,我尝试将价值传递给工厂,但失败了

async createPonyfillFactory(){
const webSpeechPonyfillFactory=wait window.WebChat.createBrowserWebSpeechPonyfillFactory();
返回选项=>{
const webSpeechPonyfill=webSpeechPonyfillFactory(选项);
返回{
SpeechGrammarList:webSpeechPonyfill.SpeechGrammarList,
SpeechRecognition:webSpeechPonyfill.SpeechRecognition,
speechSynthesis:webSpeechPonyfill.speechSynthesis,
speechsynthesistence:webSpeechPonyfill.speechsynthesistence
};
};
}

您可以通过发送到WebChat的
selectVoice
属性指定语言环境和语音。示例中对此进行了演示,以供参考

window.WebChat.renderWebChat({
directLine:window.WebChat.createDirectLine({
代币
webSocket:对
}),
选择语音:(语音、活动)=>
activity.locale==“zh HK”?
voices.find(({name})=>/TracyRUS/iu.test(name))
:
voices.find(({name})=>/JessaNeural/iu.test(name))
||voices.find(({name})=>/Jessa/iu.test(name)),
webSpeechPonyfillFactory
},document.getElementById('webchat');

希望有帮助

您可以通过发送到WebChat的
selectVoice
属性指定语言环境和语音。示例中对此进行了演示,以供参考

window.WebChat.renderWebChat({
directLine:window.WebChat.createDirectLine({
代币
webSocket:对
}),
选择语音:(语音、活动)=>
activity.locale==“zh HK”?
voices.find(({name})=>/TracyRUS/iu.test(name))
:
voices.find(({name})=>/JessaNeural/iu.test(name))
||voices.find(({name})=>/Jessa/iu.test(name)),
webSpeechPonyfillFactory
},document.getElementById('webchat');

希望有帮助

仅供参考,目前处理TTS的认知服务API可能存在暂时性问题。目前处理TTS的认知服务API可能存在暂时性问题,仅供参考。嘿,史蒂文-您的示例使用的是认知服务,而不是web语音API。我需要使用web语音API,正如您从我的代码片段中看到的,我使用的是react。嘿,史蒂文-您的示例使用的是认知服务,而不是web语音API。我需要使用web语音API,正如您从我的代码片段中看到的,我使用的是react