有人知道为什么这个文件记录在本地主机上而不是 github 服务器上吗?

Anyone know why this file is recording on local host but not on github server?

选项卡中应该会显示红色录制按钮,并且console.log您正在录制

我没有得到输出,但它可以在我的本地服务器上运行。请帮我 谢谢 github 网站是 https://codingoni.github.io/VoiceBot/。页面上只有一个按钮。 const btn = document.querySelector('.talk');const content = document.querySelector('.content');

// Responses

const greetings = ['Hi there!','Whats Going on?','I am good how are you' ];


//Weather Integration http://weatherjs.com/

//Must Change Lectures to get correct keywords
let google = 'https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures'
//

const SpeechRecognition =  window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();

recognition.onstart = ()=> {
    console.log ('voice is activated, you can talk to me');
};

recognition.onresult = (event)=> {
    const current = event.resultIndex;
    const transcript = event.results[current[0]].transcript;
    content.textContent = transcript;
    readOutLoud(transcript);
};

// add the listener to the button

btn.addEventListener('click',()=>{
    recognition.start();
});

function readOutLoud(message){
    const speech= new SpeechSynthesisUtterance();
    speach.text = 'I am not sure what that means'

    if (message.includes('Hi'||'Hey'||'How`s it going'||'What`s Happening')) {
       const finatlText = grettings[Math.floor(Math.random()*greetings.length)];
        speech.finalText;
    }else if (message.includes('How are you')) {
        const finatlText = grettings[2]
        speech.finalText;
    } else if  (message.includes('Todays Date'))        {

        const finatlText = new Date();
        speech.finalText;
    }
     //Weather Coming Soon
    speech.volume = 1;
    speech.rate= 1;
    speech.pitch = 2;


    window.speechSynthesis.speak(speech)
}

假设您 javascript 文件的名称是 app.js,您需要更改 <script> 标签的 src 属性以包含您的存储库名称。像这样:

<script src="/VoiceBot/app.js"></script>

这会解决你的问题。