Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
unable to set the value to the new SpeechSynthesisUtterance object

I have a function named TexttoSpeech which is called when the page is reloaded. The problem is I'm not able to set the value to msg.text using DOM. I'm able to see the text in console but not able to assign the value to msg.text . the document.getElementById("text").innerHTML is 1133 long

function TexttoSpeech() {
  var msg = new SpeechSynthesisUtterance();
  var voices = window.speechSynthesis.getVoices();
  msg.voice = voices[7];
  msg.volume = 1; // From 0 to 1
  msg.rate = 1; // From 0.1 to 10
  msg.pitch = 2; // From 0 to 2
  msg.text =  document.getElementById("text").innerHTML
  msg.lang = "es";
  window.speechSynthesis.speak(msg);

}

if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
  TexttoSpeech();
  redirectToNextPage(); //If the page reload this function is called
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda