feat(audio): Foreground-Service haelt TTS am Leben bei minimierter App
ARIAs Antwort wird jetzt auch dann fertig vorgelesen wenn der User die App im Hintergrund schickt. Vorher hat Android den Prozess kurz nach dem Minimieren eingefroren — TTS verstummte mitten im Satz. Native: - AriaPlaybackService.kt: Service mit foregroundServiceType=mediaPlayback, zeigt persistente Notification "ARIA spricht — antippen oeffnet die App" (channel low-priority, ongoing, tap → MainActivity) - BackgroundAudioModule.kt: RN-Bridge mit start()/stop() - AndroidManifest: FOREGROUND_SERVICE + FOREGROUND_SERVICE_MEDIA_PLAYBACK + POST_NOTIFICATIONS Permissions, Service deklariert JS: - backgroundAudio.ts: idempotenter Wrapper (active-Flag verhindert doppelte start/stop calls) - ChatScreen onPlaybackStarted → startBackgroundAudio - ChatScreen onPlaybackFinished → stopBackgroundAudio - audio.ts stopPlayback ruft auch stopBackgroundAudio damit die Notification bei Cancel/Barge-In/Anruf nicht haengen bleibt Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import { Platform, PermissionsAndroid, NativeModules, ToastAndroid } from 'react
|
||||
import Sound from 'react-native-sound';
|
||||
import RNFS from 'react-native-fs';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { stopBackgroundAudio } from './backgroundAudio';
|
||||
import AudioRecorderPlayer, {
|
||||
AudioEncoderAndroidType,
|
||||
AudioSourceAndroidType,
|
||||
@@ -898,6 +899,9 @@ class AudioService {
|
||||
|
||||
/** Laufende Wiedergabe stoppen + Queue leeren */
|
||||
stopPlayback(): void {
|
||||
// Foreground-Service auch stoppen — sonst bleibt die Notification haengen
|
||||
// wenn Wiedergabe abgebrochen wird (Anruf, Cancel, Barge-In).
|
||||
stopBackgroundAudio().catch(() => {});
|
||||
this.audioQueue = [];
|
||||
this.isPlaying = false;
|
||||
if (this.currentSound) {
|
||||
|
||||
Reference in New Issue
Block a user