我正在使用Voice RSS api进行文本到语音转换,我遇到了这个api的一些问题
这是my code
当试图在麦克风中说嗨或你好时,它工作正常,但与其他句子它没有回复
if( itsValue == 'what is your name' || itsValue == 'may I have your name' || itsValue == 'how may I address you' || itsValue == 'who are you' || itsValue == 'may I know your name' || itsValue == 'how can I call you'){
alert('df')
var text = encodeURIComponent("Opening...please wait");
document.getElementById("voiceresult").setAttribute("src", audioUrl+text);
document.getElementById("voiceresult").play();
}
这就是错误发生的原因:raw.githubusercontent.com
以明文形式提供JavaScript文件(text/plain
而不是application/javascript
)。您的浏览器启用了严格的MIME类型检查,因此它会抛出一个错误,因为它会询问一些JavaScript,但会收到看似明文的内容。
不幸的是,你对raw.githubusercontent.com
没有任何控制权,所以你有两个解决方案:
raw.githubusercontent.com
的替代品,如jsdelivr