Buenos días.
Estoy creando un sitio web, integrando la API de texto a voz de Microsoft. Y necesito activar una función cuando el audio termine de reproducirlo.
He estado investigando mucho, pero no encontré ningún método que realmente funcione.
Algún evento "onend" que funcione.
¿Sabes cómo podría lograr esto? Gracias
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; }); });