Open Rohini-Microsoft opened 1 month ago
The issue is that when I click on the speaker button, the synthesis ends before the audio does, so it's difficult to capture the event until it is finished.
Hi @yulin-li / @glharper - Any update on the above issue?
@yulin-li / @glharper - Can you please provide some updates here
We are experiencing this issue as well. We need some reliable way to know when the audio is done playing.
What happened?
Description The speech synthesis process is incorrectly marked as completed before the audio playback is actually finished.
Steps to Reproduce Detailed steps to reproduce the issue:
Expected Behavior The synthesis should be marked as completed only after the entire audio playback is finished.
Actual Behavior The synthesis is marked as completed before the audio playback is finished, resulting in an early indication of completion.
Code Snippet
const handleSpeak = async () => { try { const text = getAnswerText(); setIsSpeaking(true); const synth = await initializeSynthesizer(); const AudioContext = window.AudioContext || window.webkitAudioContext; const context = new AudioContext(); setAudioContext(context); synth.speakTextAsync( text, result => { if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) { console.log('Synthesis completed'); setIsSpeaking(false); setIsPaused(false); context.close(); } }, error => { console.error('Synthesis error:', error); setIsSpeaking(false); setIsPaused(false); context.close(); } ); } catch (error) { console.error('Error:', error); setIsSpeaking(false); setIsPaused(false); } };
Version
1.36.0 (Latest)
What browser/platform are you seeing the problem on?
No response
Relevant log output
No response