webkitSpeechRecognition Return "Network" Error in Electron

255 views Asked by At

I made an app for speech recognition using Web.Speech.Api and it works good in Chrome. But in electron my app sends back an error with message "network".

How can I use Web.Speech.Api in electron ? Does anybody have any experience with this ?

electron version : https://i.stack.imgur.com/8cibA.png

Code :

this.recognition = new (window.SpeechRecognition || webkitSpeechRecognition || mozSpeechRecognition || msSpeechRecognition)();

this.recognition.interimResults = false;
this.recognition.lang = 'th-TH';

this.recognition.start()

this.recognition.onresult = (e: any) => {
        const result :  SpeechRecognitionAlternative = e.results[0][0];
        const transcript : string = result.transcript;
            console.log(transcript.trim().toLocaleLowerCase());
    }
   
this.recognition.onerror = (e: any) => {
        console.log('onerror : ' , e )
        this.recognition.stop();
    }

Error : https://i.stack.imgur.com/BwYjJ.png

0

There are 0 answers