繁体   English   中英

Azure SpeechSynthesizer 错误 HTTP:不支持。 预期的 HTTPS:NPM `microsoft-cognitiveservices-speech-sdk`

[英]Azure SpeechSynthesizer Error HTTP: not supported. Expected HTTPS: NPM `microsoft-cognitiveservices-speech-sdk`

我正在使用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)
}

对我来说,这个问题与 Sentry 集成有关。 更多信息: https : //github.com/microsoft/cognitive-services-speech-sdk-js/issues/458

到目前为止似乎问题没有解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM