Giter Site home page Giter Site logo

Comments (34)

JamesBrill avatar JamesBrill commented on September 27, 2024
  • Which version are you using?
  • Which options are you setting on SpeechRecognition?
  • If you debug or console.log the properties injected by SpeechRecognition, what do you see?
  • Are you using it offline? (I recall your previous issue on this repo, which asked about offline use)

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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)

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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?
Screen Shot 2019-03-28 at 22 06 58

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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.

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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?

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Hard-code the version with:

"react-speech-recognition": "1.0.7",

in your package.json and then run npm install.

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Another test to see if the Web Speech API is working in your browser:

  • Open Dev Tools
  • Open Console
  • Run
const recognition = new webkitSpeechRecognition();
recognition.start();
  • Do you see the red recording icon?

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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:
Screen Shot 2019-03-28 at 22 16 21

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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?

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

No

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Which browser are you using?

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

Google Chrome
Version 73.0.3683.86 (Official Build) (64-bit)

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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:

  • Restart your browser and run those two lines again
  • Is your microphone broken?

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

gonna restart whole computer again, and browser, and then test mic, will be back with results.

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Haha drastic measures indeed! πŸ˜„ I look forward to the results.

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

oh and mic seems to be working, did a test record and the test setup in system prefs

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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?

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

correct.

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

What properties are on your recognition object? Just run

const recognition = new webkitSpeechRecognition();
recognition

Do you see an object like this?
Screen Shot 2019-03-28 at 22 40 21

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

Screen Shot 2019-03-28 at 3 41 17 PM

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Did you instantiate it first?

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024
const recognition = new webkitSpeechRecognition();
recognition

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

Screen Shot 2019-03-28 at 3 43 27 PM

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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/

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

yeah, super weird.

Screen Shot 2019-03-28 at 3 45 46 PM

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.

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Could you screenshot the thing that says the microphone is not allowed?

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

Screen Shot 2019-03-28 at 3 49 34 PM

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

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

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Though that link says you'd get prompted if the app tried to access the microphone again...

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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).

from react-speech-recognition.

CygnusBell avatar CygnusBell commented on September 27, 2024

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!

from react-speech-recognition.

JamesBrill avatar JamesBrill commented on September 27, 2024

Glad to hear you're unblocked! This was fun. πŸ˜„

from react-speech-recognition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.