Matthias Nott
2026-03-07 0e888d62af1434fef231e11a5c307a5b48a8deb1
app/chat.tsx
....@@ -11,7 +11,7 @@
1111 import { ImageCaptionModal } from "../components/chat/ImageCaptionModal";
1212 import { StatusDot } from "../components/ui/StatusDot";
1313 import { SessionDrawer } from "../components/SessionDrawer";
14
-import { playAudio, stopPlayback, isPlaying, onPlayingChange } from "../services/audio";
14
+import { playSingle, stopPlayback, isPlaying, onPlayingChange } from "../services/audio";
1515
1616 interface StagedImage {
1717 base64: string;
....@@ -32,7 +32,7 @@
3232 const [stagedImage, setStagedImage] = useState<StagedImage | null>(null);
3333
3434 useEffect(() => {
35
- return onPlayingChange(setAudioPlaying);
35
+ return onPlayingChange((uri) => setAudioPlaying(uri !== null));
3636 }, []);
3737
3838 const handleScreenshot = useCallback(() => {
....@@ -137,10 +137,8 @@
137137 }
138138 for (let i = messages.length - 1; i >= 0; i--) {
139139 const msg = messages[i];
140
- if (msg.role === "assistant") {
141
- if (msg.audioUri) {
142
- playAudio(msg.audioUri).catch(() => {});
143
- }
140
+ if (msg.role === "assistant" && msg.audioUri) {
141
+ playSingle(msg.audioUri).catch(() => {});
144142 return;
145143 }
146144 }