Closed CygnusBell closed 5 years ago
SpeechRecognition
?console.log
the properties injected by SpeechRecognition
, what do you see?Version: 1.1.0 Options: none, just the default. Console.log for these items... console.log(transcript); console.log(resetTranscript); console.log(browserSupportsSpeechRecognition);
returns "True", a blank line, and a function...
"ƒ () { interimTranscript = ''; finalTranscript = ''; _this.disconnect('RESET'); _this.setState({ interimTranscript: interimTranscript, finalTranscript: finalTran…"
Haha, no, not offline, you made that clear it's not possible :) Even in that case though it gave an error, this is just nothing.
Here is the full code of the app I'm trying to make work now. It was just taken from a stack exchange sample file.
import React, {Component } from 'react' import SpeechRecognition from 'react-speech-recognition'
class Dictaphone extends Component { render() { const { transcript, resetTranscript, browserSupportsSpeechRecognition } = this.props
if (!browserSupportsSpeechRecognition) {
return null
}
return (
<div>
<button onClick={resetTranscript}>Reset</button>
<span>{transcript}</span>
</div>
)
}
}
export default SpeechRecognition(Dictaphone)
I have used this same example code using version 1.1.0 and it behaves as normal.
When you run the app, do you see the red recording icon in your Chrome tab?
No. I used to, but now for some reason it doesn't. I must've done something to goof it up, but not sure how to track it down since it was working last time I ran it about 3 weeks ago.
To help me determine if this is a bug in 1.1.0 (which was released last week), can you revert back to 1.0.7 and see if you still get the issue?
Hard-code the version with:
"react-speech-recognition": "1.0.7",
in your package.json
and then run npm install
.
Another test to see if the Web Speech API is working in your browser:
const recognition = new webkitSpeechRecognition();
recognition.start();
Another possibility is that you accidentally blocked your app from using your microphone in Chrome. If that is the case, you will see this icon in the right-hand side of your address bar:
Using 1.0.7 did not fix. It's not the blocked microphone, checked that earlier.
When I try to run...
const recognition = new webkitSpeechRecognition(); recognition.start();
I get...
undefined
When I try to run...
const recognition = new webkitSpeechRecognition(); recognition.start();
I get...
undefined
Yes, but does the recognition start and the red icon appear on your tab?
No
Which browser are you using?
Google Chrome Version 73.0.3683.86 (Official Build) (64-bit)
I have the same version and the two lines of code I posted above turned on the recognition. Web Speech API isn't working in your browser for some reason.
Two thoughts:
gonna restart whole computer again, and browser, and then test mic, will be back with results.
Haha drastic measures indeed! 😄 I look forward to the results.
still not working :(
I restarted computer, restarted chrome and disabled all extensions... I gotta be doing something really stupid to make this not work lol
oh and mic seems to be working, did a test record and the test setup in system prefs
And to double-check, when you run
const recognition = new webkitSpeechRecognition();
recognition.start();
in a new tab, you do not see the flashing red recording icon in your tab?
correct.
What properties are on your recognition
object? Just run
const recognition = new webkitSpeechRecognition();
recognition
Do you see an object like this?
Did you instantiate it first?
const recognition = new webkitSpeechRecognition();
recognition
And when you run recognition.start()
, no flashing icon... Weird.
Here's a good test: try this website https://www.cs.cmu.edu/~dst/SpeechDemo/
yeah, super weird.
This is interesting, it's saying not allowed even though in site settings it's set to "ask" and when I toggle it to "allowed" it still says not allowed. I wonder if there's some global permission I messed up at some point.
Could you screenshot the thing that says the microphone is not allowed?
I'm pulling at straws here, but is it possible that Chrome itself is blocked by your operating system from using the microphone? You mentioned System Preferences earlier, so I guess you're using a Mac. Maybe check this out? https://support.apple.com/en-gb/guide/mac-help/control-access-to-your-microphone-on-mac-mchla1b1e1fe/mac
Though that link says you'd get prompted if the app tried to access the microphone again...
THAT WAS IT!!!!!
THANKS FOR GRASPING THE STRAWS!!!
I was googling for hours for something like this but just kept coming across stuff about SSLs.
I guess this was in the system update and I just had no idea it was even a thing.
AGAIN THANK YOU SO MUCH (and sorry it had nothing to do with your component really).
Though that link says you'd get prompted if the app tried to access the microphone again...
Yeah, it says that, but there was no such prompt lol hence having no idea where to check. Thank you again!
Glad to hear you're unblocked! This was fun. 😄
Hi, I've been using this for about 8 months now and it's worked great, but all of a sudden it won't work for me.
In my main app as well as just creating a simple app with just the getting started code.
It's not throwing an error or anything, the app compiles fine but then just does nothing in the browser.
Please advise. I know this is kind of ambiguous but I'm not sure what other info I can provide. Would appreciate any info greatly :)