microsoft / cognitive-services-speech-sdk-js

Microsoft Azure Cognitive Services Speech SDK for JavaScript
Other
252 stars 91 forks source link

[Bug]: No way to determine when the produced audio has completed #813

Closed OldManMeta closed 2 months ago

OldManMeta commented 2 months ago

What happened?

I've not found any way to determine when the audio has completed. Am I missing something? All of the ResultReason options do not appear to support it or event out on audio playback complete.

Many thanks for any pointers in resolving this

EDIT: related to #656 which is not resolved I see. This is a pretty important feature guys.

synthesizer.speakSsmlAsync(this.ssml, (result) => {
          if (result.reason === ResultReason.SynthesizingAudioCompleted) {

            //Testing
            console.log('Speech not finished - just the actual Synthesis has finished.');

            this.synchronizeVisemesWithAudio(result.audioData, audioContext);

          } else {
            console.error('Speech synthesis canceled:', result.errorDetails);
          }

Version

1.29.0

What browser/platform are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge, React

Relevant log output

No response

yulin-li commented 2 months ago

As I replied in that issue, you can refer to onAudioEnd

A more detailed sample

https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/synthesis.html#L370C9-L388C1

jpalvarezl commented 2 months ago

I have added the pending close label, as @yulin-li has provided a path forward for this issue.