stop streaming play after get input audio.

This commit is contained in:
lloydzhou 2024-11-07 18:57:57 +08:00
parent b78e5db817
commit 283caba8ce

View File

@ -202,7 +202,6 @@ export function RealtimeChat({
}; };
const handleInputAudio = async (item: RTInputAudioItem) => { const handleInputAudio = async (item: RTInputAudioItem) => {
audioHandlerRef.current?.stopStreamingPlayback();
await item.waitForCompletion(); await item.waitForCompletion();
if (item.transcription) { if (item.transcription) {
const userMessage = createMessage({ const userMessage = createMessage({
@ -226,6 +225,8 @@ export function RealtimeChat({
}); });
}); });
} }
// stop streaming play after get input audio.
audioHandlerRef.current?.stopStreamingPlayback();
}; };
const toggleRecording = async () => { const toggleRecording = async () => {