【发布时间】:2022-01-04 12:21:48
【问题描述】:
我正在使用 microsoft-congnitiveservices-speech-sdk npm 包,一切正常。但随机我现在得到一个错误。浏览器更新或次要软件包更新中断(?)
'Unable to contact server. StatusCode: 500, undefined Reason: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"'
我已经尝试过本地开发 HTTP 服务器以及使用 HTTPS 安全的生产站点。有什么想法或解决方案可以解决 microsoft-congnitiveservices-speech-sdk 问题吗?
import * as Azure from "microsoft-cognitiveservices-speech-sdk";
const speechConfig = Azure.SpeechConfig.fromSubscription(SPEECH_KEY, SPEECH_REGION);
speechConfig.speechSynthesisOutputFormat = Azure.SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3;
const synthesizer = new Azure.SpeechSynthesizer(speechConfig);
const ssml = `
<speak version="1.0" xmlns="https://www.w3.org/2001/10/synthesis" xml:lang="en-US">
<voice name="en-US-JennyNeural">
<prosody volume="85" pitch="medium" rate="1">
<break time="1.5s" /> ${text}
</prosody>
</voice>
</speak>
`
try {
synthesizer.speakSsmlAsync(
ssml,
result => {
synthesizer.close();
console.log('RESULT', result)
resolve(result);
},
error => {
synthesizer.close();
console.log('ERROR', error)
if(error) throw Error(error)
});
}
catch(err) {
console.log(err)
throw(err)
}
【问题讨论】:
-
大家好,我是微软 TTS 团队的工程师 Yulin。这么晚才回复很抱歉。您的代码看起来不错并且错误消息很奇怪,因为 SDK 将始终尝试使用 https 或 wss 端点。你能分享我的小复制,以便我可以帮助调试吗?
-
我也有同样的问题,这个消息突然出现,没有代码/依赖改变
标签: javascript node.js azure npm azure-cognitive-services