added visual waiting steps
All checks were successful
Deploy FluentGerman.ai / deploy (push) Successful in 52s

This commit is contained in:
2026-02-18 12:47:58 +01:00
parent 557b7c28aa
commit 829238dd2f
2 changed files with 7 additions and 5 deletions

View File

@@ -147,6 +147,8 @@ class VoiceManager {
stopRecording() {
if (this.mode === 'api') {
if (this.mediaRecorder?.state === 'recording') {
// Show processing state immediately (don't wait for onstop callback)
if (this.onProcessing) this.onProcessing(true);
this.mediaRecorder.stop();
} else {
this.isRecording = false;
@@ -240,17 +242,20 @@ class VoiceManager {
return new Promise(resolve => {
audio.onended = () => {
if (avatarContainer) avatarContainer.classList.remove('speaking');
URL.revokeObjectURL(audioUrl);
resolve();
};
// Handle errors during playback (e.g. format issues)
audio.onerror = () => {
if (avatarContainer) avatarContainer.classList.remove('speaking');
URL.revokeObjectURL(audioUrl);
resolve();
}
});
} catch (e) {
console.error("Playback failed", e);
if (avatarContainer) avatarContainer.classList.remove('speaking');
URL.revokeObjectURL(audioUrl);
}
}