react-native-davoice-tts 1.0.319 → 1.0.321
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/ios/SpeechBridge/SpeechBridge.m +71 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +3 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +428 -219
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +3 -0
- 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/Headers/DavoiceTTS-Swift.h +6 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +630 -421
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +8 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +8 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +630 -421
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +8 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +8 -5
- 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 +27 -27
- package/package.json +1 -1
- package/speech/index.ts +60 -13
|
@@ -53,6 +53,11 @@ import phonemes
|
|
|
53
53
|
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
54
54
|
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
55
55
|
}
|
|
56
|
+
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
57
|
+
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
58
|
+
@objc override dynamic public init()
|
|
59
|
+
@objc deinit
|
|
60
|
+
}
|
|
56
61
|
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
57
62
|
public typealias IsEngineReady = () -> Swift.Bool
|
|
58
63
|
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
@@ -65,11 +70,6 @@ public enum AudioPlaybackHook {
|
|
|
65
70
|
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
66
71
|
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
67
72
|
}
|
|
68
|
-
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
69
|
-
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
70
|
-
@objc override dynamic public init()
|
|
71
|
-
@objc deinit
|
|
72
|
-
}
|
|
73
73
|
public enum SVLogLevel : Swift.Int, Swift.Codable {
|
|
74
74
|
case off, error, warn, info, debug, trace
|
|
75
75
|
public init?(rawValue: Swift.Int)
|
|
@@ -189,7 +189,10 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
189
189
|
@objc public static let supportedEvents: [Swift.String]
|
|
190
190
|
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
191
191
|
@objc final public func pauseSpeechRecognitionLite()
|
|
192
|
+
@objc final public func pauseSpeechRecognitionLiteAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
192
193
|
@objc final public func unPauseSpeechRecognitionLite(_ times: Foundation.NSNumber)
|
|
194
|
+
@objc(unPauseSpeechRecognitionLite:preFetch:) final public func unPauseSpeechRecognitionLite(_ times: Foundation.NSNumber, preFetch: Foundation.NSNumber)
|
|
195
|
+
@objc final public func unPauseSpeechRecognitionLiteAndWait(_ times: Foundation.NSNumber, preFetch: Foundation.NSNumber, timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
193
196
|
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
194
197
|
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
195
198
|
@objc final public func pauseMicrophone()
|
|
@@ -53,6 +53,11 @@ import phonemes
|
|
|
53
53
|
@objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
|
|
54
54
|
@objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
|
|
55
55
|
}
|
|
56
|
+
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
57
|
+
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
58
|
+
@objc override dynamic public init()
|
|
59
|
+
@objc deinit
|
|
60
|
+
}
|
|
56
61
|
public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
|
|
57
62
|
public typealias IsEngineReady = () -> Swift.Bool
|
|
58
63
|
public typealias useOnlyEnginePlayback = () -> Swift.Bool
|
|
@@ -65,11 +70,6 @@ public enum AudioPlaybackHook {
|
|
|
65
70
|
public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
|
|
66
71
|
public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
|
|
67
72
|
}
|
|
68
|
-
@_inheritsConvenienceInitializers @objc final public class LicenseManager : ObjectiveC.NSObject {
|
|
69
|
-
@objc public static func isLicenseValid(licenseKey: Swift.String) -> Swift.Bool
|
|
70
|
-
@objc override dynamic public init()
|
|
71
|
-
@objc deinit
|
|
72
|
-
}
|
|
73
73
|
public enum SVLogLevel : Swift.Int, Swift.Codable {
|
|
74
74
|
case off, error, warn, info, debug, trace
|
|
75
75
|
public init?(rawValue: Swift.Int)
|
|
@@ -189,7 +189,10 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
|
|
|
189
189
|
@objc public static let supportedEvents: [Swift.String]
|
|
190
190
|
@objc final public func setLicense(licenseKey: Swift.String) -> Swift.Bool
|
|
191
191
|
@objc final public func pauseSpeechRecognitionLite()
|
|
192
|
+
@objc final public func pauseSpeechRecognitionLiteAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
192
193
|
@objc final public func unPauseSpeechRecognitionLite(_ times: Foundation.NSNumber)
|
|
194
|
+
@objc(unPauseSpeechRecognitionLite:preFetch:) final public func unPauseSpeechRecognitionLite(_ times: Foundation.NSNumber, preFetch: Foundation.NSNumber)
|
|
195
|
+
@objc final public func unPauseSpeechRecognitionLiteAndWait(_ times: Foundation.NSNumber, preFetch: Foundation.NSNumber, timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
193
196
|
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
194
197
|
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
195
198
|
@objc final public func pauseMicrophone()
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/DavoiceTTS-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
O9fuulSbauw2eQFehC0CQllYmK0=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Info.plist</key>
|
|
12
12
|
<data>
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
9CFGBqNMnh3cwOoi38aVBgsneqk=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
iZ9SB6PLiy0mvvKUm31ZjWrdPY8=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
24
24
|
<data>
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
iZ9SB6PLiy0mvvKUm31ZjWrdPY8=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
jp/eQj6hR7QPBMc0xBNk10JXAQM=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
9CFGBqNMnh3cwOoi38aVBgsneqk=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
6dQ7pJyDbRInQCGa8BRk3B9JBRY=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
44
44
|
<data>
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
6dQ7pJyDbRInQCGa8BRk3B9JBRY=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
08QaJH5IFQQUTX61OdpSPYcdDbQ=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/module.modulemap</key>
|
|
56
56
|
<data>
|
|
@@ -63,33 +63,33 @@
|
|
|
63
63
|
<dict>
|
|
64
64
|
<key>hash</key>
|
|
65
65
|
<data>
|
|
66
|
-
|
|
66
|
+
O9fuulSbauw2eQFehC0CQllYmK0=
|
|
67
67
|
</data>
|
|
68
68
|
<key>hash2</key>
|
|
69
69
|
<data>
|
|
70
|
-
|
|
70
|
+
Y0gWRE1HbAh+Ep+eN90BRhHRY+BHK6RCoEHXGwJT6yU=
|
|
71
71
|
</data>
|
|
72
72
|
</dict>
|
|
73
73
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
74
74
|
<dict>
|
|
75
75
|
<key>hash</key>
|
|
76
76
|
<data>
|
|
77
|
-
|
|
77
|
+
9CFGBqNMnh3cwOoi38aVBgsneqk=
|
|
78
78
|
</data>
|
|
79
79
|
<key>hash2</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
YOKYBImLcHgWJLcSItgIoJJaujhZ3De9+PCgVsi2Wl0=
|
|
82
82
|
</data>
|
|
83
83
|
</dict>
|
|
84
84
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
85
85
|
<dict>
|
|
86
86
|
<key>hash</key>
|
|
87
87
|
<data>
|
|
88
|
-
|
|
88
|
+
iZ9SB6PLiy0mvvKUm31ZjWrdPY8=
|
|
89
89
|
</data>
|
|
90
90
|
<key>hash2</key>
|
|
91
91
|
<data>
|
|
92
|
-
|
|
92
|
+
6yqMqwnkQOtfKqVrzCxqU/p/UmJb+VLLlaIT8BVf9FI=
|
|
93
93
|
</data>
|
|
94
94
|
</dict>
|
|
95
95
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -107,44 +107,44 @@
|
|
|
107
107
|
<dict>
|
|
108
108
|
<key>hash</key>
|
|
109
109
|
<data>
|
|
110
|
-
|
|
110
|
+
iZ9SB6PLiy0mvvKUm31ZjWrdPY8=
|
|
111
111
|
</data>
|
|
112
112
|
<key>hash2</key>
|
|
113
113
|
<data>
|
|
114
|
-
|
|
114
|
+
6yqMqwnkQOtfKqVrzCxqU/p/UmJb+VLLlaIT8BVf9FI=
|
|
115
115
|
</data>
|
|
116
116
|
</dict>
|
|
117
117
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
118
118
|
<dict>
|
|
119
119
|
<key>hash</key>
|
|
120
120
|
<data>
|
|
121
|
-
|
|
121
|
+
jp/eQj6hR7QPBMc0xBNk10JXAQM=
|
|
122
122
|
</data>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
7BXGUKiPQUkLePIFPa0Nxbqpj3p9wZKkqtUnN6jwE4M=
|
|
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
|
+
9CFGBqNMnh3cwOoi38aVBgsneqk=
|
|
133
133
|
</data>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
YOKYBImLcHgWJLcSItgIoJJaujhZ3De9+PCgVsi2Wl0=
|
|
137
137
|
</data>
|
|
138
138
|
</dict>
|
|
139
139
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
140
140
|
<dict>
|
|
141
141
|
<key>hash</key>
|
|
142
142
|
<data>
|
|
143
|
-
|
|
143
|
+
6dQ7pJyDbRInQCGa8BRk3B9JBRY=
|
|
144
144
|
</data>
|
|
145
145
|
<key>hash2</key>
|
|
146
146
|
<data>
|
|
147
|
-
|
|
147
|
+
GwE5m+vZsiC5Yb1S83RtpV6FORCCBOreebjmXNXoSSw=
|
|
148
148
|
</data>
|
|
149
149
|
</dict>
|
|
150
150
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -162,22 +162,22 @@
|
|
|
162
162
|
<dict>
|
|
163
163
|
<key>hash</key>
|
|
164
164
|
<data>
|
|
165
|
-
|
|
165
|
+
6dQ7pJyDbRInQCGa8BRk3B9JBRY=
|
|
166
166
|
</data>
|
|
167
167
|
<key>hash2</key>
|
|
168
168
|
<data>
|
|
169
|
-
|
|
169
|
+
GwE5m+vZsiC5Yb1S83RtpV6FORCCBOreebjmXNXoSSw=
|
|
170
170
|
</data>
|
|
171
171
|
</dict>
|
|
172
172
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
173
173
|
<dict>
|
|
174
174
|
<key>hash</key>
|
|
175
175
|
<data>
|
|
176
|
-
|
|
176
|
+
08QaJH5IFQQUTX61OdpSPYcdDbQ=
|
|
177
177
|
</data>
|
|
178
178
|
<key>hash2</key>
|
|
179
179
|
<data>
|
|
180
|
-
|
|
180
|
+
72qZhHIICmK61DshcqfMQUoiTgAt3/eW412CPptXn9k=
|
|
181
181
|
</data>
|
|
182
182
|
</dict>
|
|
183
183
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -524,7 +524,8 @@ class Speech {
|
|
|
524
524
|
return this.start(locale);
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
|
|
527
|
+
// TODO: CHECK THE NATIVE SIDE DOES NOT REALLY AWAITS
|
|
528
|
+
async pauseSpeechRecognition(): Promise<void> {
|
|
528
529
|
this.logCall('pauseSpeechRecognitionLite');
|
|
529
530
|
|
|
530
531
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
@@ -532,10 +533,16 @@ class Speech {
|
|
|
532
533
|
|
|
533
534
|
if (!fn) {
|
|
534
535
|
dbg(`pauseSpeechRecognitionLite not available on ${Platform.OS === 'ios' ? 'NativeSpeech' : 'NativeSTT'}`);
|
|
535
|
-
return
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (Platform.OS === 'ios' && typeof mod?.pauseSpeechRecognitionLiteAsync === 'function') {
|
|
540
|
+
const result = await mod.pauseSpeechRecognitionLiteAsync(1500);
|
|
541
|
+
if (result?.ok === false) dbgErr('pauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
542
|
+
return;
|
|
536
543
|
}
|
|
537
544
|
if (Platform.OS === 'ios') {
|
|
538
|
-
|
|
545
|
+
await new Promise<void>((resolve, reject) => {
|
|
539
546
|
try {
|
|
540
547
|
fn.call(mod, (ok: boolean) => {
|
|
541
548
|
if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
|
|
@@ -545,9 +552,10 @@ class Speech {
|
|
|
545
552
|
reject(e as any);
|
|
546
553
|
}
|
|
547
554
|
});
|
|
555
|
+
return;
|
|
548
556
|
}
|
|
549
557
|
|
|
550
|
-
|
|
558
|
+
await new Promise<void>((resolve, reject) => {
|
|
551
559
|
try {
|
|
552
560
|
fn.call(mod, async (ok: boolean) => {
|
|
553
561
|
if (!ok) dbgErr('pauseSpeechRecognitionLite returned false');
|
|
@@ -561,37 +569,59 @@ class Speech {
|
|
|
561
569
|
});
|
|
562
570
|
}
|
|
563
571
|
|
|
564
|
-
unPauseSpeechRecognition(times: number): Promise<void> {
|
|
565
|
-
this.logCall('unPauseSpeechRecognitionLite', { times });
|
|
572
|
+
async unPauseSpeechRecognition(times: number, preFetchMs: number = 0): Promise<void> {
|
|
573
|
+
this.logCall('unPauseSpeechRecognitionLite', { times, preFetchMs });
|
|
566
574
|
|
|
567
575
|
const mod: any = Platform.OS === 'ios' ? NativeSpeech : NativeSTT;
|
|
568
576
|
const fn = mod?.unPauseSpeechRecognitionLite;
|
|
569
577
|
|
|
570
578
|
if (!fn) {
|
|
571
579
|
dbg(`unPauseSpeechRecognitionLite(times) not available on ${Platform.OS === 'ios' ? 'NativeSpeech' : 'NativeSTT'}`);
|
|
572
|
-
return
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (Platform.OS === 'ios' && typeof mod?.unPauseSpeechRecognitionLiteAsync === 'function') {
|
|
584
|
+
const result = await mod.unPauseSpeechRecognitionLiteAsync(times, preFetchMs, 2500);
|
|
585
|
+
if (result?.ok === false) dbgErr('unPauseSpeechRecognitionLiteAsync failed', result?.reason);
|
|
586
|
+
return;
|
|
573
587
|
}
|
|
574
588
|
|
|
575
589
|
if (Platform.OS === 'ios') {
|
|
576
|
-
|
|
590
|
+
await new Promise<void>((resolve, reject) => {
|
|
577
591
|
try {
|
|
578
|
-
|
|
592
|
+
const done = (ok: boolean) => {
|
|
579
593
|
if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
|
|
594
|
+
dbg('[CALL unPauseSpeechRecognitionLite] native callback fired', { times, preFetchMs, ok });
|
|
580
595
|
resolve();
|
|
581
|
-
}
|
|
596
|
+
};
|
|
597
|
+
if (preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
598
|
+
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS prefetch bridge', { times, preFetchMs });
|
|
599
|
+
mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
dbg('[CALL unPauseSpeechRecognitionLite] invoking iOS legacy bridge', { times, preFetchMs });
|
|
603
|
+
fn.call(mod, times, done);
|
|
604
|
+
dbg('[CALL unPauseSpeechRecognitionLite] returned from JS->native invocation', { times, preFetchMs });
|
|
582
605
|
} catch (e) {
|
|
606
|
+
dbgErr('[CALL unPauseSpeechRecognitionLite] exception before native callback', String(e));
|
|
583
607
|
reject(e as any);
|
|
584
608
|
}
|
|
585
609
|
});
|
|
610
|
+
return;
|
|
586
611
|
}
|
|
587
|
-
|
|
612
|
+
await new Promise<void>((resolve, reject) => {
|
|
588
613
|
try {
|
|
589
|
-
|
|
614
|
+
const done = async (ok: boolean) => {
|
|
590
615
|
if (!ok) dbgErr('unPauseSpeechRecognitionLite(times) returned false');
|
|
591
616
|
// ✅ ANDROID: small delay before resolving
|
|
592
617
|
if (Platform.OS === 'android') await sleep(500);
|
|
593
618
|
resolve();
|
|
594
|
-
}
|
|
619
|
+
};
|
|
620
|
+
if (Platform.OS === 'android' && preFetchMs > 0 && typeof mod?.unPauseSpeechRecognitionLiteWithPreFetch === 'function') {
|
|
621
|
+
mod.unPauseSpeechRecognitionLiteWithPreFetch(times, preFetchMs, done);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
fn.call(mod, times, done);
|
|
595
625
|
} catch (e) {
|
|
596
626
|
reject(e as any);
|
|
597
627
|
}
|
|
@@ -760,6 +790,23 @@ class Speech {
|
|
|
760
790
|
return results.every(Boolean);
|
|
761
791
|
}
|
|
762
792
|
|
|
793
|
+
async setAECEnabled(enabled: boolean): Promise<void> {
|
|
794
|
+
const value = !!enabled;
|
|
795
|
+
|
|
796
|
+
if (Platform.OS === 'ios' && NativeSpeech?.setAECEnabled) {
|
|
797
|
+
await NativeSpeech.setAECEnabled(value);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (NativeSTT?.setAECEnabled) {
|
|
802
|
+
await NativeSTT.setAECEnabled(value);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
console.warn("AEC not supported on this platform");
|
|
806
|
+
return;
|
|
807
|
+
//throw new Error('setAECEnabled not available on this platform.');
|
|
808
|
+
}
|
|
809
|
+
|
|
763
810
|
// ---------- TTS ----------
|
|
764
811
|
async initTTS(modelOrConfig: ModelRef | { model: ModelRef }) {
|
|
765
812
|
const cfg =
|