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

279
Visualizações
Microsoft azure "text to speech" javascript, onend event

Good day.

I'm making a website, integrating the microsoft text-to-speech API. And I need to activate a function when the audio finishes playing it.

I've been doing a lot of research but I didn't find any method that really works.

Some "onend" event that works.

Do you know how I could achieve this? Thank you

    startSpeakTextAsyncButton.addEventListener("click", function () {
          startSpeakTextAsyncButton.disabled = true;
          resultDiv.innerHTML = "";
          
          synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig);
  
          synthesizer.speakTextAsync(
            phraseDiv.value,
            function (result) { 
              startSpeakTextAsyncButton.disabled = false;
              resultDiv.innerHTML = "synthesis in process";
              if (result.reason === SpeechSDK.ResultReason.SynthesizingAudioCompleted) {
                resultDiv.innerHTML = "synthesis finished";
              } else if (result.reason === SpeechSDK.ResultReason.Canceled) {
                resultDiv.innerHTML = "synthesis failed. Error detail: " + result.errorDetails + "\n";
              }
              
              synthesizer.close();
              synthesizer = undefined;
            },
            function (err) { 
              startSpeakTextAsyncButton.disabled = false;
              resultDiv.innerHTML = "Error: ";
              resultDiv.innerHTML = err;
              resultDiv.innerHTML = "\n";
              window.console.log(err);
  
              synthesizer.close();
              synthesizer = undefined;
          });

        });
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