react-native-davoice-tts 1.0.256 → 1.0.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TTSRNBridge.podspec +1 -1
- package/package.json +1 -1
- package/speech/index.ts +9 -3
package/TTSRNBridge.podspec
CHANGED
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
Pod::Spec.new do |s|
|
|
4
4
|
s.name = "TTSRNBridge"
|
|
5
|
-
s.version = "1.0.
|
|
5
|
+
s.version = "1.0.130" # Update to your package version
|
|
6
6
|
s.summary = "TTS for React Native."
|
|
7
7
|
s.description = <<-DESC
|
|
8
8
|
A React Native module for tts .
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -131,13 +131,16 @@ class Speech {
|
|
|
131
131
|
return (NativeTTS as any).speak(text, speakerId, s);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
private _speakAndWait(text: string, speakerId: number, s: number, timeoutMs =
|
|
134
|
+
private _speakAndWait(text: string, speakerId: number, s: number, timeoutMs = 15000) {
|
|
135
135
|
return new Promise<void>((resolve, reject) => {
|
|
136
136
|
this.ttsPendingResolve = resolve;
|
|
137
137
|
// safety: never hang forever
|
|
138
138
|
this.ttsPendingTimeout = setTimeout(() => {
|
|
139
|
+
dbg('Timeout waiting for onFinishedSpeaking — releasing wait');
|
|
140
|
+
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
141
|
+
const r = this.ttsPendingResolve;
|
|
139
142
|
this.ttsPendingResolve = null;
|
|
140
|
-
|
|
143
|
+
if (r) r(); // ✅ accept after timeout
|
|
141
144
|
}, timeoutMs);
|
|
142
145
|
try {
|
|
143
146
|
this._nativeSpeak(text, speakerId, s);
|
|
@@ -559,8 +562,11 @@ class Speech {
|
|
|
559
562
|
return new Promise<void>((resolve, reject) => {
|
|
560
563
|
this.ttsPendingResolve = resolve; // reuse existing resolver + event
|
|
561
564
|
this.ttsPendingTimeout = setTimeout(() => {
|
|
565
|
+
dbg('Timeout waiting for onFinishedSpeaking — releasing wait');
|
|
566
|
+
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
567
|
+
const r = this.ttsPendingResolve;
|
|
562
568
|
this.ttsPendingResolve = null;
|
|
563
|
-
|
|
569
|
+
if (r) r(); // ✅ accept after timeout
|
|
564
570
|
}, timeoutMs);
|
|
565
571
|
|
|
566
572
|
try {
|