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

103
Vistas
la API web de texto a voz da como resultado un error en la configuración de voz

en un botón, haga clic en Quiero decir blue sky en idioma en-US .
este código da como resultado un error en la línea utterThis.voice
por favor ayuda

 var synth = window.speechSynthesis; $('button').on('click', function(){ var utterThis = new SpeechSynthesisUtterance('blue sky'); utterThis.rate = 1; utterThis.pitch = 1; utterThis.voice = {voiceURI: 'Google US English', name: 'Google US English', lang: 'en-US', localService: false, default: false}; synth.speak(utterThis); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button>CLICK</button>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Debe usar una de las voces devueltas por .getVoices : asignar un objeto simple a .voice no funcionará.

 $('button').on('click', function() { var utterThis = new SpeechSynthesisUtterance('blue sky'); utterThis.rate = 1; utterThis.pitch = 1; for (const v of speechSynthesis.getVoices()) { if (v.voiceURI === 'Google US English') { utterThis.voice = v; } } speechSynthesis.speak(utterThis); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button>CLICK</button>

Las voces devueltas por .getVoices son verificadas por el navegador / sistema operativo para que sean compatibles, y están claramente vinculadas a un servicio subyacente que traduce el texto en voz; un objeto simple, por otro lado, no lo hace, por lo que un simple el objeto no funciona.

about 4 years ago · Juan Pablo Isaza Denunciar
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