Skip to content

Commit 336c620

Browse files
authored
Update fast-search-card.js
1 parent f6c0c9f commit 336c620

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

dist/fast-search-card.js

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12559,46 +12559,22 @@ class FastSearchCard extends HTMLElement {
1255912559
}
1256012560
}
1256112561

12562-
// 🎧 EVENT-BASIERTE TTS-ÜBERWACHUNG (überwacht Media Content)
12562+
// 🎧 SIMPLE TTS TIMING (für Player die State nicht ändern)
1256312563
async startTTSMonitoring(entityId) {
12564-
console.log('🎧 Starting TTS monitoring...');
12564+
console.log('🎧 Starting TTS timing...');
1256512565

12566-
// 💾 TTS-Start-Zustand speichern
12567-
const initialState = this._hass.states[entityId];
12568-
const ttsContentId = initialState.attributes.media_content_id;
12569-
console.log('🎤 TTS Content ID:', ttsContentId);
12566+
// 🕒 Warte 2 Sekunden Basis + 200ms pro Zeichen
12567+
const textarea = this.shadowRoot?.querySelector('.tts-textarea');
12568+
const text = textarea?.value || '';
12569+
const simpleDuration = 2000 + (text.length * 200); // Sehr konservativ
1257012570

12571-
let checkCount = 0;
12572-
const maxChecks = 60;
12571+
console.log(`⏰ Simple TTS duration: ${simpleDuration}ms for "${text}"`);
1257312572

12574-
const monitorInterval = setInterval(async () => {
12575-
checkCount++;
12576-
12577-
if (!this.isTTSActive || checkCount > maxChecks) {
12578-
console.log('🛑 TTS monitoring stopped (timeout or inactive)');
12579-
clearInterval(monitorInterval);
12580-
await this.finalizeTTSProcess(entityId);
12581-
return;
12582-
}
12583-
12584-
const currentState = this._hass.states[entityId];
12585-
const currentContentId = currentState.attributes.media_content_id;
12586-
12587-
console.log(`🔍 TTS Monitor check ${checkCount}: Content = ${currentContentId}`);
12588-
12589-
// 🎯 TTS beendet: Media Content hat sich geändert oder ist leer
12590-
if (currentContentId !== ttsContentId || !currentContentId) {
12591-
console.log('🎉 TTS completed! Media content changed');
12592-
clearInterval(monitorInterval);
12593-
12594-
await new Promise(resolve => setTimeout(resolve, 500));
12595-
await this.restorePlayerContext();
12596-
await this.finalizeTTSProcess(entityId);
12597-
}
12598-
12599-
}, 1000);
12600-
12601-
this.ttsMonitorInterval = monitorInterval;
12573+
setTimeout(async () => {
12574+
console.log('🎉 TTS timing completed');
12575+
await this.restorePlayerContext();
12576+
await this.finalizeTTSProcess(entityId);
12577+
}, simpleDuration);
1260212578
}
1260312579

1260412580
// 🏁 TTS-PROZESS FINALISIEREN

0 commit comments

Comments
 (0)