Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2750b867a3 | |||
| f6424add6c | |||
| 2dfd21d1d0 | |||
| 9d9ddc730b |
@@ -79,8 +79,8 @@ android {
|
|||||||
applicationId "com.ariacockpit"
|
applicationId "com.ariacockpit"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 905
|
versionCode 906
|
||||||
versionName "0.0.9.5"
|
versionName "0.0.9.6"
|
||||||
// Fallback fuer Libraries mit Product Flavors
|
// Fallback fuer Libraries mit Product Flavors
|
||||||
missingDimensionStrategy 'react-native-camera', 'general'
|
missingDimensionStrategy 'react-native-camera', 'general'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aria-cockpit",
|
"name": "aria-cockpit",
|
||||||
"version": "0.0.9.5",
|
"version": "0.0.9.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
|
|||||||
@@ -890,6 +890,7 @@ const ChatScreen: React.FC = () => {
|
|||||||
// Alle Pending Anhaenge + Text senden
|
// Alle Pending Anhaenge + Text senden
|
||||||
const sendPendingAttachments = useCallback(async (messageText: string) => {
|
const sendPendingAttachments = useCallback(async (messageText: string) => {
|
||||||
if (pendingAttachments.length === 0) return;
|
if (pendingAttachments.length === 0) return;
|
||||||
|
console.log('[Chat] sendPendingAttachments: %d Anhang/Anhaenge', pendingAttachments.length);
|
||||||
const location = await getCurrentLocation();
|
const location = await getCurrentLocation();
|
||||||
const msgId = nextId();
|
const msgId = nextId();
|
||||||
|
|
||||||
@@ -939,6 +940,8 @@ const ChatScreen: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// An RVS senden
|
// An RVS senden
|
||||||
|
console.log('[Chat] sende file: name=%s mime=%s size=%s b64Bytes=%s',
|
||||||
|
name, mimeType, file.size, base64.length);
|
||||||
rvs.send('file', {
|
rvs.send('file', {
|
||||||
name,
|
name,
|
||||||
type: mimeType,
|
type: mimeType,
|
||||||
|
|||||||
@@ -399,10 +399,13 @@ class AudioService {
|
|||||||
* weiter obwohl das Audio gestoppt ist — der erste Halt ist der echte. */
|
* weiter obwohl das Audio gestoppt ist — der erste Halt ist der echte. */
|
||||||
captureInterruption(): number {
|
captureInterruption(): number {
|
||||||
if (this.pausedMessageId) {
|
if (this.pausedMessageId) {
|
||||||
// Schon erfasst — nicht ueberschreiben (zweiter Aufruf bei offhook).
|
console.log('[Audio] captureInterruption: bereits erfasst (msgId=%s pos=%ss) — skip',
|
||||||
|
this.pausedMessageId, this.pausedPosition.toFixed(2));
|
||||||
return this.pausedPosition;
|
return this.pausedPosition;
|
||||||
}
|
}
|
||||||
if (!this.playbackStartTime || !this.currentPlaybackMsgId) {
|
if (!this.playbackStartTime || !this.currentPlaybackMsgId) {
|
||||||
|
console.log('[Audio] captureInterruption: nichts spielte (startTime=%s, msgId=%s)',
|
||||||
|
this.playbackStartTime, this.currentPlaybackMsgId || '(leer)');
|
||||||
this.pausedPosition = 0;
|
this.pausedPosition = 0;
|
||||||
this.pausedMessageId = '';
|
this.pausedMessageId = '';
|
||||||
return 0;
|
return 0;
|
||||||
@@ -422,7 +425,12 @@ class AudioService {
|
|||||||
async resumeFromInterruption(maxWaitMs: number = 30000): Promise<boolean> {
|
async resumeFromInterruption(maxWaitMs: number = 30000): Promise<boolean> {
|
||||||
const msgId = this.pausedMessageId;
|
const msgId = this.pausedMessageId;
|
||||||
const position = this.pausedPosition;
|
const position = this.pausedPosition;
|
||||||
if (!msgId) return false;
|
if (!msgId) {
|
||||||
|
console.log('[Audio] resumeFromInterruption: kein gemerkter Stand — skip');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log('[Audio] resumeFromInterruption: starte fuer msgId=%s pos=%ss',
|
||||||
|
msgId, position.toFixed(2));
|
||||||
this.pausedMessageId = ''; // konsumieren
|
this.pausedMessageId = ''; // konsumieren
|
||||||
const cachePath = `${RNFS.DocumentDirectoryPath}/tts_cache/${msgId}.wav`;
|
const cachePath = `${RNFS.DocumentDirectoryPath}/tts_cache/${msgId}.wav`;
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
@@ -456,6 +464,14 @@ class AudioService {
|
|||||||
this._firePlaybackStarted();
|
this._firePlaybackStarted();
|
||||||
this.isPlaying = true;
|
this.isPlaying = true;
|
||||||
this.resumeSound = sound;
|
this.resumeSound = sound;
|
||||||
|
// Tracking auch fuer den Resume-Sound aktualisieren — sonst kann
|
||||||
|
// captureInterruption bei einem zweiten Anruf die Position nicht
|
||||||
|
// mehr ermitteln (playbackStartTime waere von der ersten Wiedergabe).
|
||||||
|
const msgIdMatch = path.match(/([0-9a-f-]+)\.wav$/i);
|
||||||
|
if (msgIdMatch) this.currentPlaybackMsgId = msgIdMatch[1];
|
||||||
|
// Virtuelle Start-Zeit so setzen, dass captureInterruption (das den
|
||||||
|
// Leading-Silence-Offset wieder abzieht) die korrekte Position liefert.
|
||||||
|
this.playbackStartTime = Date.now() - (positionSec + this.LEADING_SILENCE_SEC) * 1000;
|
||||||
console.log('[Audio] Resume von Position %ss aus %s',
|
console.log('[Audio] Resume von Position %ss aus %s',
|
||||||
positionSec.toFixed(2), path);
|
positionSec.toFixed(2), path);
|
||||||
sound.setCurrentTime(Math.max(0, positionSec));
|
sound.setCurrentTime(Math.max(0, positionSec));
|
||||||
@@ -991,7 +1007,10 @@ class AudioService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Audio aus lokaler Datei (file:// Pfad) in die Queue und abspielen. */
|
/** Audio aus lokaler Datei (file:// Pfad) in die Queue und abspielen.
|
||||||
|
* Setzt zusaetzlich playbackStartTime + currentPlaybackMsgId damit ein
|
||||||
|
* Anruf waehrend dieses Playbacks korrekt erfasst wird (ohne dieses
|
||||||
|
* Tracking liefert captureInterruption nichts → kein Auto-Resume). */
|
||||||
async playFromPath(filePath: string): Promise<void> {
|
async playFromPath(filePath: string): Promise<void> {
|
||||||
if (!filePath) return;
|
if (!filePath) return;
|
||||||
try {
|
try {
|
||||||
@@ -1000,6 +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);
|
||||||
|
if (msgIdMatch) {
|
||||||
|
this.currentPlaybackMsgId = msgIdMatch[1];
|
||||||
|
// Start-Zeit so setzen dass elapsed = LEADING (≈ 0 nach captureInterruption-Berechnung)
|
||||||
|
this.playbackStartTime = Date.now() - this.LEADING_SILENCE_SEC * 1000;
|
||||||
|
}
|
||||||
const b64 = await RNFS.readFile(cleanPath, 'base64');
|
const b64 = await RNFS.readFile(cleanPath, 'base64');
|
||||||
this.playAudio(b64);
|
this.playAudio(b64);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user