Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
React speech-to-text and text-to-speech on IOS

I really new with react, i'm trying to create a speech to text app using react, i use this module https://github.com/MikeyParton/react-speech-kit. Here's my speech recognition funtion

function SpeechRecognition() {
  const [lang, setLang] = useState("en-US");
  const [value, setValue] = useState("");
  const [blocked, setBlocked] = useState(false);

  const onEnd = () => {
    // You could do something here after listening has finished
  };

  const onResult = (result) => {
    setValue(result);
  };

  const changeLang = (event) => {
    setLang(event.target.value);
  };

  const onError = (event) => {
    if (event.error === "not-allowed") {
      setBlocked(true);
    }
  };

  const { listen, listening, stop, supported } = useSpeechRecognition({
    onResult,
    onEnd,
    onError,
  });

  const toggle = listening
    ? stop
    : () => {
        setBlocked(false);
        listen({ lang });
      };

  return (
      <button disabled={blocked} type="button" onClick={toggle}>
          {listening ? (
            <FontAwesomeIcon icon={faMicrophoneSlash} />
          ) : (
            <FontAwesomeIcon icon={faMicrophone} />
          )}
        </button>
  );
}

it is working on android and windows on any browser, but i can't make it work on IOS whether it's safari or chrome. After i researching about IOS webspeech API, i found this post http://iwearshorts.com/blog/ios-safari-partial-support-of-web-speech-api/ but i cant figure out how to use this line of code on my code

var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition || null;

https://bory-webspeech.netlify.app/ demo of my current development

EDIT

I change this line

const { listen, listening, stop, supported } = useSpeechRecognition({

to

const SpeechRecognition = useSpeechRecognition|| webkitSpeechRecognition || null;
`const { listen, listening, stop, supported } = SpeechRecognition ({`

but on IOS it's still not working

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda