Reputation: 2953
I'm trying to build a Javascript bot by using Puppeteer to open a https URL where I can listen for the microphone and output a transcript from the SpeechRecogniton API built in a browser, the below code seems to log something in normal Chrome, but on Chromium I get nothing despite this feature apparently being supported according to Modernizr. I've allowed microphone permissions but I get a dead console.log
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition
const recognition = new SpeechRecognition()
recognition.interimResults = true
recognition.addEventListener('result', e => {
const transcript = Array.from(e.results)
.map(result => result[0])
.map(result => result.transcript)
.join('')
// I get nothing logged here in Chromium
console.log(transcript)
})
recognition.addEventListener('end', recognition.start)
recognition.start()
UPDATE
After adding the following...
recognition.addEventListener('error', function(event) {
console.log('Speech recognition error detected: ' + event.error);
});
I'm getting a Network
error... and don't know what to do about this in Chromium?
Upvotes: 1
Views: 1315
Reputation: 19
Chromium no longer supports SpeechRecognition. I believe it's got something to do with Google wanting people to use their cloud services instead.
Upvotes: 1