react-native-davoice 1.0.15 → 1.0.17
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/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
- package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +5330 -5253
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +18 -18
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +18 -18
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +159 -82
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +159 -82
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +12 -12
- package/package.json +1 -1
- package/speech/index.ts +91 -70
|
Binary file
|
|
Binary file
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
zlxvefjJg3h/jt5qeZHb+N7DBpY=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
qUIBpzxfiowD7+wRfQCgC1cwoO4=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
zlxvefjJg3h/jt5qeZHb+N7DBpY=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
pWNhR1hbdUjnxKQWaNJiPqyIPy4=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/module.modulemap</key>
|
|
56
56
|
<data>
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
<dict>
|
|
75
75
|
<key>hash</key>
|
|
76
76
|
<data>
|
|
77
|
-
|
|
77
|
+
zlxvefjJg3h/jt5qeZHb+N7DBpY=
|
|
78
78
|
</data>
|
|
79
79
|
<key>hash2</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
+/mfzYug3wDg6xhZGNPwFvg61j3OzKPOT/FENvv92Z8=
|
|
82
82
|
</data>
|
|
83
83
|
</dict>
|
|
84
84
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
@@ -118,22 +118,22 @@
|
|
|
118
118
|
<dict>
|
|
119
119
|
<key>hash</key>
|
|
120
120
|
<data>
|
|
121
|
-
|
|
121
|
+
qUIBpzxfiowD7+wRfQCgC1cwoO4=
|
|
122
122
|
</data>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
CfXGjvtVIBdDpzHp/bkUUseFqsADKG4MVv1YmadKFjQ=
|
|
126
126
|
</data>
|
|
127
127
|
</dict>
|
|
128
128
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
129
129
|
<dict>
|
|
130
130
|
<key>hash</key>
|
|
131
131
|
<data>
|
|
132
|
-
|
|
132
|
+
zlxvefjJg3h/jt5qeZHb+N7DBpY=
|
|
133
133
|
</data>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
+/mfzYug3wDg6xhZGNPwFvg61j3OzKPOT/FENvv92Z8=
|
|
137
137
|
</data>
|
|
138
138
|
</dict>
|
|
139
139
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
@@ -173,11 +173,11 @@
|
|
|
173
173
|
<dict>
|
|
174
174
|
<key>hash</key>
|
|
175
175
|
<data>
|
|
176
|
-
|
|
176
|
+
pWNhR1hbdUjnxKQWaNJiPqyIPy4=
|
|
177
177
|
</data>
|
|
178
178
|
<key>hash2</key>
|
|
179
179
|
<data>
|
|
180
|
-
|
|
180
|
+
Z1DpugneMk7RuRqIL+2Cb5HhwjeY9yEICICuFFQz+PY=
|
|
181
181
|
</data>
|
|
182
182
|
</dict>
|
|
183
183
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -126,6 +126,7 @@ class Speech {
|
|
|
126
126
|
private ttsChain: Promise<void> = Promise.resolve();
|
|
127
127
|
private ttsPendingResolve: (() => void) | null = null;
|
|
128
128
|
private ttsPendingTimeout: any = null;
|
|
129
|
+
private sttTransitionChain: Promise<void> = Promise.resolve();
|
|
129
130
|
|
|
130
131
|
private dbgAsset(label: string, x: any) {
|
|
131
132
|
try {
|
|
@@ -161,6 +162,22 @@ class Speech {
|
|
|
161
162
|
return (NativeTTS as any).speak(text, speakerId, s);
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
private enqueueSttTransition(opId: string, kind: 'pause' | 'unpause', work: () => Promise<void>): Promise<void> {
|
|
166
|
+
const previous = this.sttTransitionChain.catch(() => {});
|
|
167
|
+
const run = previous.then(async () => {
|
|
168
|
+
dbg('[sttTransition] begin', { opId, kind });
|
|
169
|
+
try {
|
|
170
|
+
await work();
|
|
171
|
+
dbg('[sttTransition] end', { opId, kind });
|
|
172
|
+
} catch (e) {
|
|
173
|
+
dbgErr('[sttTransition] failed', { opId, kind, error: String(e) });
|
|
174
|
+
throw e;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
this.sttTransitionChain = run.catch(() => {});
|
|
178
|
+
return run;
|
|
179
|
+
}
|
|
180
|
+
|
|
164
181
|
private _speakAndWait(text: string, speakerId: number, s: number, timeoutMs = 600000) {
|
|
165
182
|
return new Promise<void>((resolve, reject) => {
|
|
166
183
|
this.ttsPendingResolve = resolve;
|
|
@@ -632,43 +649,45 @@ class Speech {
|
|
|
632
649
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
633
650
|
const fn = mod?.pauseSpeechRecognitionLite;
|
|
634
651
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
652
|
+
await this.enqueueSttTransition(opId, 'pause', async () => {
|
|
653
|
+
if (!fn) {
|
|
654
|
+
dbg(`pauseSpeechRecognitionLite not available on ${Platform.OS === 'ios' ? 'NativeSpeech' : 'NativeSTT'}`);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (Platform.OS === 'ios' && typeof mod?.pauseSpeechRecognitionLiteAsync === 'function') {
|
|
659
|
+
dbg('[pauseSpeechRecognitionLiteAsync] begin', { opId, timeoutMs: 1500 });
|
|
660
|
+
const result = await mod.pauseSpeechRecognitionLiteAsync(1500);
|
|
661
|
+
dbg('[pauseSpeechRecognitionLiteAsync] resolved', { opId, elapsedMs: Date.now() - startedAt, result });
|
|
662
|
+
if (result?.ok === false) dbgErr('pauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (Platform.OS === 'ios') {
|
|
666
|
+
await new Promise<void>((resolve, reject) => {
|
|
667
|
+
try {
|
|
668
|
+
fn.call(mod, (ok: boolean) => {
|
|
669
|
+
if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
|
|
670
|
+
resolve();
|
|
671
|
+
});
|
|
672
|
+
} catch (e) {
|
|
673
|
+
reject(e as any);
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
639
678
|
|
|
640
|
-
if (Platform.OS === 'ios' && typeof mod?.pauseSpeechRecognitionLiteAsync === 'function') {
|
|
641
|
-
dbg('[pauseSpeechRecognitionLiteAsync] begin', { opId, timeoutMs: 1500 });
|
|
642
|
-
const result = await mod.pauseSpeechRecognitionLiteAsync(1500);
|
|
643
|
-
dbg('[pauseSpeechRecognitionLiteAsync] resolved', { opId, elapsedMs: Date.now() - startedAt, result });
|
|
644
|
-
if (result?.ok === false) dbgErr('pauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
if (Platform.OS === 'ios') {
|
|
648
679
|
await new Promise<void>((resolve, reject) => {
|
|
649
680
|
try {
|
|
650
|
-
fn.call(mod, (ok: boolean) => {
|
|
681
|
+
fn.call(mod, async (ok: boolean) => {
|
|
651
682
|
if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
|
|
683
|
+
// ✅ ANDROID: small delay before resolving
|
|
684
|
+
if (Platform.OS === 'android') await sleep(500);
|
|
652
685
|
resolve();
|
|
653
686
|
});
|
|
654
687
|
} catch (e) {
|
|
655
688
|
reject(e as any);
|
|
656
689
|
}
|
|
657
690
|
});
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
await new Promise<void>((resolve, reject) => {
|
|
662
|
-
try {
|
|
663
|
-
fn.call(mod, async (ok: boolean) => {
|
|
664
|
-
if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
|
|
665
|
-
// ✅ ANDROID: small delay before resolving
|
|
666
|
-
if (Platform.OS === 'android') await sleep(500);
|
|
667
|
-
resolve();
|
|
668
|
-
});
|
|
669
|
-
} catch (e) {
|
|
670
|
-
reject(e as any);
|
|
671
|
-
}
|
|
672
691
|
});
|
|
673
692
|
}
|
|
674
693
|
|
|
@@ -684,64 +703,66 @@ class Speech {
|
|
|
684
703
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
685
704
|
const fn = mod?.unPauseSpeechRecognitionLite;
|
|
686
705
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
706
|
+
await this.enqueueSttTransition(opId, 'unpause', async () => {
|
|
707
|
+
if (!fn) {
|
|
708
|
+
dbg(`unPauseSpeechRecognitionLite(times) not available on ${Platform.OS === 'ios' ? 'NativeSpeech' : 'NativeSTT'}`);
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
691
711
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
712
|
+
if (Platform.OS === 'ios' && typeof mod?.unPauseSpeechRecognitionLiteAsync === 'function') {
|
|
713
|
+
dbg('[unPauseSpeechRecognitionLiteAsync] begin', { opId, times, preFetchMs, timeoutMs });
|
|
714
|
+
const result = await mod.unPauseSpeechRecognitionLiteAsync(times, preFetchMs, timeoutMs);
|
|
715
|
+
dbg('[unPauseSpeechRecognitionLiteAsync] resolved', {
|
|
716
|
+
opId,
|
|
717
|
+
times,
|
|
718
|
+
preFetchMs,
|
|
719
|
+
elapsedMs: Date.now() - startedAt,
|
|
720
|
+
result,
|
|
721
|
+
});
|
|
722
|
+
if (result?.ok === false) dbgErr('unPauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
705
725
|
|
|
706
|
-
|
|
726
|
+
if (Platform.OS === 'ios') {
|
|
727
|
+
await new Promise<void>((resolve, reject) => {
|
|
728
|
+
try {
|
|
729
|
+
const done = (ok: boolean) => {
|
|
730
|
+
if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
|
|
731
|
+
dbg('[CALL unPauseSpeechRecognitionLite] native callback fired', { times, preFetchMs, ok });
|
|
732
|
+
resolve();
|
|
733
|
+
};
|
|
734
|
+
if (preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
735
|
+
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS prefetch bridge', { times, preFetchMs });
|
|
736
|
+
mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS legacy bridge', { times, preFetchMs });
|
|
740
|
+
fn.call(mod, times, done);
|
|
741
|
+
dbg('[CALL unPauseSpeechRecognitionLite] returned from JS->native invocation', { times, preFetchMs });
|
|
742
|
+
} catch (e) {
|
|
743
|
+
dbgErr('[CALL unPauseSpeechRecognitionLite] exception before native callback', String(e));
|
|
744
|
+
reject(e as any);
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
707
749
|
await new Promise<void>((resolve, reject) => {
|
|
708
750
|
try {
|
|
709
|
-
const done = (ok: boolean) => {
|
|
751
|
+
const done = async (ok: boolean) => {
|
|
710
752
|
if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
|
|
711
|
-
|
|
753
|
+
// ✅ ANDROID: small delay before resolving
|
|
754
|
+
if (Platform.OS === 'android') await sleep(500);
|
|
712
755
|
resolve();
|
|
713
756
|
};
|
|
714
|
-
if (preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
715
|
-
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS prefetch bridge', { times, preFetchMs });
|
|
757
|
+
if (Platform.OS === 'android' && preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
716
758
|
mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
|
|
717
759
|
return;
|
|
718
760
|
}
|
|
719
|
-
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS legacy bridge', { times, preFetchMs });
|
|
720
761
|
fn.call(mod, times, done);
|
|
721
|
-
dbg('[CALL unPauseSpeechRecognitionLite] returned from JS->native invocation', { times, preFetchMs });
|
|
722
762
|
} catch (e) {
|
|
723
|
-
dbgErr('[CALL unPauseSpeechRecognitionLite] exception before native callback', String(e));
|
|
724
763
|
reject(e as any);
|
|
725
764
|
}
|
|
726
765
|
});
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
await new Promise<void>((resolve, reject) => {
|
|
730
|
-
try {
|
|
731
|
-
const done = async (ok: boolean) => {
|
|
732
|
-
if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
|
|
733
|
-
// ✅ ANDROID: small delay before resolving
|
|
734
|
-
if (Platform.OS === 'android') await sleep(500);
|
|
735
|
-
resolve();
|
|
736
|
-
};
|
|
737
|
-
if (Platform.OS === 'android' && preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
738
|
-
mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
fn.call(mod, times, done);
|
|
742
|
-
} catch (e) {
|
|
743
|
-
reject(e as any);
|
|
744
|
-
}
|
|
745
766
|
});
|
|
746
767
|
}
|
|
747
768
|
/** Pause mic/STT (Android native; iOS unified if present) */
|