fix(audio): Spotify spielt nicht mehr in der ARIA-Verarbeitungspause
Logcat-Befund: zwischen User-Aufnahme-Ende und TTS-Start liegt eine ~20s-Pause (Whisper STT + Claude + F5-TTS). In dieser Zeit hatte ARIA keinen AudioFocus → Spotify lief munter weiter, dann pausierte beim TTS-Start. Stefan hoerte das als 'Spotify kommt nach 20s wieder'. Fix: ChatScreen ruft acquireConversationFocus sobald ein agent_activity- Event mit activity != 'idle' kommt. Solange ARIA arbeitet (thinking/ tool/responding) bleibt der Focus gehalten, Spotify bleibt pausiert. Bei onPlaybackFinished oder cancelRequest wird releaseConversationFocus gerufen — sonst bliebe Spotify ewig stumm. Funktioniert auch fuer reine Text-Chats (kein Wake-Word noetig). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -495,6 +495,13 @@ const ChatScreen: React.FC = () => {
|
||||
const activity = (message.payload.activity as string) || 'idle';
|
||||
const tool = (message.payload.tool as string) || '';
|
||||
setAgentActivity({ activity, tool });
|
||||
// Solange ARIA arbeitet (thinking/tool/responding) den Conversation-
|
||||
// Focus halten — sonst spielt Spotify in der ~20s-Verarbeitungspause
|
||||
// zwischen User-Aufnahme-Ende und TTS-Start wieder. Bei 'idle' wird
|
||||
// der Focus nur dann released wenn auch kein TTS mehr aktiv ist.
|
||||
if (activity !== 'idle') {
|
||||
audioService.acquireConversationFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// Voice-Config aus Diagnostic — setzt die lokale App-Stimme auf den
|
||||
@@ -658,6 +665,10 @@ const ChatScreen: React.FC = () => {
|
||||
});
|
||||
const unsubTtsEnd = audioService.onPlaybackFinished(() => {
|
||||
releaseBackgroundAudio('tts').catch(() => {});
|
||||
// ARIAs Antwort komplett vorgelesen → Conversation-Focus freigeben damit
|
||||
// Spotify wieder darf. Vorher (waehrend agentActivity != idle) hat das
|
||||
// acquireConversationFocus den Focus durchgehend gehalten.
|
||||
audioService.releaseConversationFocus();
|
||||
// Vor naechster Aufnahme: barge-listening aus damit der AudioRecorder
|
||||
// das Mikro greifen kann.
|
||||
wakeWordService.stopBargeListening().catch(() => {});
|
||||
@@ -807,6 +818,9 @@ const ChatScreen: React.FC = () => {
|
||||
const cancelRequest = useCallback(() => {
|
||||
setAgentActivity({ activity: 'idle', tool: '' });
|
||||
rvs.send('cancel_request' as any, {});
|
||||
// Conversation-Focus freigeben — es kommt keine TTS-Antwort mehr,
|
||||
// sonst bliebe Spotify ewig pausiert.
|
||||
audioService.releaseConversationFocus();
|
||||
}, []);
|
||||
|
||||
// Barge-In: wenn der User waehrend ARIA arbeitet/spricht eine neue Sprach-
|
||||
|
||||
Reference in New Issue
Block a user