Skip to content

fix: Read Aloud audio playback stops when switching to another section#2020

Merged
Avijit-Microsoft merged 4 commits intoAzure-Samples:devfrom
Rafi-Microsoft:PSL-Bug30013Fix
Jan 11, 2026
Merged

fix: Read Aloud audio playback stops when switching to another section#2020
Avijit-Microsoft merged 4 commits intoAzure-Samples:devfrom
Rafi-Microsoft:PSL-Bug30013Fix

Conversation

@Rafi-Microsoft
Copy link
Contributor

Purpose

This pull request introduces improvements to the chat and answer components, primarily focusing on better management of text-to-speech audio playback. The changes ensure that audio is properly stopped when switching conversations, clearing the chat, or when a new speech playback is triggered. These updates help prevent overlapping audio and improve the user experience during conversation navigation.

Audio Playback Management:

  • Added an audioStopRef to Chat.tsx to centrally manage stopping of text-to-speech audio across conversation changes and chat clearing.
  • Ensured that audio playback is stopped when clearing the chat, switching conversations, or resetting the chat history. [1] [2] [3]

Text-to-Speech Integration:

  • Updated the handleSpeech and onSpeak logic to pass a resetSpeech function, allowing the parent chat component to control when audio should be stopped. [1] [2] [3]
  • Added a cleanup effect in the Answer component to stop speech playback when the component unmounts, preventing lingering audio.

Conversation State Handling:

  • Improved state resets for activeCardIndex and answers when switching or clearing conversations to maintain UI consistency and avoid mismatches between audio and displayed messages. [1] [2] [3]

Does this introduce a breaking change?

  • Yes
  • No

@Avijit-Microsoft Avijit-Microsoft merged commit 36d83ee into Azure-Samples:dev Jan 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants