fix(audio): msgId-Regex liberaler — auch nicht-UUID-Dateinamen werden erkannt
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -467,7 +467,7 @@ class AudioService {
|
|||||||
// Tracking auch fuer den Resume-Sound aktualisieren — sonst kann
|
// Tracking auch fuer den Resume-Sound aktualisieren — sonst kann
|
||||||
// captureInterruption bei einem zweiten Anruf die Position nicht
|
// captureInterruption bei einem zweiten Anruf die Position nicht
|
||||||
// mehr ermitteln (playbackStartTime waere von der ersten Wiedergabe).
|
// mehr ermitteln (playbackStartTime waere von der ersten Wiedergabe).
|
||||||
const msgIdMatch = path.match(/([0-9a-f-]+)\.wav$/i);
|
const msgIdMatch = path.match(/([^/\\]+)\.wav$/i);
|
||||||
if (msgIdMatch) this.currentPlaybackMsgId = msgIdMatch[1];
|
if (msgIdMatch) this.currentPlaybackMsgId = msgIdMatch[1];
|
||||||
// Virtuelle Start-Zeit so setzen, dass captureInterruption (das den
|
// Virtuelle Start-Zeit so setzen, dass captureInterruption (das den
|
||||||
// Leading-Silence-Offset wieder abzieht) die korrekte Position liefert.
|
// Leading-Silence-Offset wieder abzieht) die korrekte Position liefert.
|
||||||
@@ -1019,10 +1019,12 @@ class AudioService {
|
|||||||
console.warn('[Audio] Cache-Datei existiert nicht mehr:', cleanPath);
|
console.warn('[Audio] Cache-Datei existiert nicht mehr:', cleanPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const msgIdMatch = cleanPath.match(/([0-9a-f-]+)\.wav$/i);
|
// Dateiname ohne .wav als messageId nehmen (egal ob UUID oder andere ID)
|
||||||
if (msgIdMatch) {
|
const fileMatch = cleanPath.match(/([^/\\]+)\.wav$/i);
|
||||||
this.currentPlaybackMsgId = msgIdMatch[1];
|
const msgId = fileMatch ? fileMatch[1] : '';
|
||||||
// Start-Zeit so setzen dass elapsed = LEADING (≈ 0 nach captureInterruption-Berechnung)
|
console.log('[Audio] playFromPath: cleanPath=%s → msgId=%s', cleanPath, msgId || '(leer)');
|
||||||
|
if (msgId) {
|
||||||
|
this.currentPlaybackMsgId = msgId;
|
||||||
this.playbackStartTime = Date.now() - this.LEADING_SILENCE_SEC * 1000;
|
this.playbackStartTime = Date.now() - this.LEADING_SILENCE_SEC * 1000;
|
||||||
}
|
}
|
||||||
const b64 = await RNFS.readFile(cleanPath, 'base64');
|
const b64 = await RNFS.readFile(cleanPath, 'base64');
|
||||||
|
|||||||
Reference in New Issue
Block a user