Luca448 commited on
Commit
334c9bb
·
1 Parent(s): 542d37f

Fix: TTS allow multiple rapid skips with debounce (BUILD 1.5.10)

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. src/services/tts-service.js +15 -3
index.html CHANGED
@@ -51,7 +51,7 @@
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
- <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.5.9</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
+ <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.5.10</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/services/tts-service.js CHANGED
@@ -188,7 +188,11 @@ class TTSService {
188
  if (this.utterance) this.utterance.onend = null;
189
  this.synth.cancel();
190
  this.currentChunkIndex++;
191
- if (this.isPlaying) this.playChunk();
 
 
 
 
192
  } else {
193
  this.stop(); // End of text
194
  }
@@ -199,12 +203,20 @@ class TTSService {
199
  if (this.utterance) this.utterance.onend = null;
200
  this.synth.cancel();
201
  this.currentChunkIndex--;
202
- if (this.isPlaying) this.playChunk();
 
 
 
 
203
  } else {
204
  // Restart current chunk
205
  if (this.utterance) this.utterance.onend = null;
206
  this.synth.cancel();
207
- if (this.isPlaying) this.playChunk();
 
 
 
 
208
  }
209
  }
210
 
 
188
  if (this.utterance) this.utterance.onend = null;
189
  this.synth.cancel();
190
  this.currentChunkIndex++;
191
+
192
+ clearTimeout(this.skipTimeout);
193
+ this.skipTimeout = setTimeout(() => {
194
+ if (this.isPlaying) this.playChunk();
195
+ }, 250);
196
  } else {
197
  this.stop(); // End of text
198
  }
 
203
  if (this.utterance) this.utterance.onend = null;
204
  this.synth.cancel();
205
  this.currentChunkIndex--;
206
+
207
+ clearTimeout(this.skipTimeout);
208
+ this.skipTimeout = setTimeout(() => {
209
+ if (this.isPlaying) this.playChunk();
210
+ }, 250);
211
  } else {
212
  // Restart current chunk
213
  if (this.utterance) this.utterance.onend = null;
214
  this.synth.cancel();
215
+
216
+ clearTimeout(this.skipTimeout);
217
+ this.skipTimeout = setTimeout(() => {
218
+ if (this.isPlaying) this.playChunk();
219
+ }, 250);
220
  }
221
  }
222