Reputation: 178
I am using the JavaScript version of Microsoft Cognitive Services Speech SDK from https://github.com/Azure-Samples/cognitive-services-speech-sdk.
About the SpeechSynthesizer, I include SpeakerAudioDestination to it. I want to do something when the audio playback is done so I add onAudioEnd event, but it is never fired. Is the code below correct?
player = new SpeechSDK.SpeakerAudioDestination();
player.onAudioEnd = function (s) {
console.log("onAudioEnd", s);
};
synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig,
SpeechSDK.AudioConfig.fromSpeakerOutput(player));
Any help is appreciated!
Upvotes: 3
Views: 1270
Reputation: 178
Inside the synthesizer.speakTextAsync() callback, synthesizer.close() needs to called for player.onAudioEnd event to be fired.
Upvotes: 5