react-native-davoice-tts 1.0.394 → 1.0.396
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/DaVoiceTTSBridge.m +75 -24
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
- 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 +23 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +1068 -354
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +15 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +15 -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 +46 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +1068 -354
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +15 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +15 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +1068 -354
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +15 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +15 -0
- 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 +33 -33
- package/package.json +1 -1
- package/speech/index.d.ts +263 -0
- package/speech/index.ts +50 -29
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.377" # 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 .
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b2bbfb5fb59b4529ddc6a6e9ebb9a69a tts-1.0.0.aar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
827b55bde2ad6f58b9dcbb9d538917ab978d660c tts-1.0.0.aar
|
|
@@ -149,6 +149,54 @@ RCT_EXPORT_MODULE();
|
|
|
149
149
|
return [NSURL fileURLWithPath:pathOrURL];
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// Model initialization must not perform remote I/O on the React Native bridge
|
|
153
|
+
// queue. Local paths are resolved asynchronously as well, so initTTS has one
|
|
154
|
+
// consistent completion path and never blocks the bridge while resolving a model.
|
|
155
|
+
- (void)resolveModelURLFromPathOrURL:(NSString *)pathOrURL
|
|
156
|
+
completion:(void (^)(NSURL * _Nullable modelURL))completion
|
|
157
|
+
{
|
|
158
|
+
if (!pathOrURL || (id)pathOrURL == [NSNull null] || pathOrURL.length == 0) {
|
|
159
|
+
dispatch_async(dispatch_get_main_queue(), ^{ completion(nil); });
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
NSURL *candidate = [NSURL URLWithString:pathOrURL];
|
|
164
|
+
BOOL isRemote = [pathOrURL hasPrefix:@"http://"] || [pathOrURL hasPrefix:@"https://"];
|
|
165
|
+
if (!isRemote) {
|
|
166
|
+
dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
|
|
167
|
+
NSURL *url = [self resolveLocalURLFromPathOrURL:pathOrURL];
|
|
168
|
+
dispatch_async(dispatch_get_main_queue(), ^{ completion(url); });
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!candidate) {
|
|
174
|
+
dispatch_async(dispatch_get_main_queue(), ^{ completion(nil); });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
|
|
179
|
+
configuration.timeoutIntervalForRequest = 8.0;
|
|
180
|
+
configuration.timeoutIntervalForResource = 15.0;
|
|
181
|
+
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
|
|
182
|
+
NSURLSessionDataTask *task = [session dataTaskWithURL:candidate
|
|
183
|
+
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
|
184
|
+
NSInteger status = [response isKindOfClass:[NSHTTPURLResponse class]]
|
|
185
|
+
? ((NSHTTPURLResponse *)response).statusCode : 200;
|
|
186
|
+
NSURL *result = nil;
|
|
187
|
+
if (!error && data.length > 0 && status < 400) {
|
|
188
|
+
NSString *extension = candidate.pathExtension.length ? candidate.pathExtension : @"bin";
|
|
189
|
+
NSString *name = [NSString stringWithFormat:@"rn_model_%f.%@",
|
|
190
|
+
[[NSDate date] timeIntervalSince1970], extension];
|
|
191
|
+
NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:name];
|
|
192
|
+
if ([data writeToFile:path atomically:YES]) result = [NSURL fileURLWithPath:path];
|
|
193
|
+
}
|
|
194
|
+
[session finishTasksAndInvalidate];
|
|
195
|
+
dispatch_async(dispatch_get_main_queue(), ^{ completion(result); });
|
|
196
|
+
}];
|
|
197
|
+
[task resume];
|
|
198
|
+
}
|
|
199
|
+
|
|
152
200
|
RCT_EXPORT_METHOD(setLicense:(NSString *)licenseKey
|
|
153
201
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
154
202
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
@@ -191,36 +239,39 @@ RCT_EXPORT_METHOD(initTTS:(NSDictionary *)configDict
|
|
|
191
239
|
return;
|
|
192
240
|
}
|
|
193
241
|
|
|
194
|
-
NSURL *modelURL
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
201
|
-
NSError *error = nil;
|
|
202
|
-
DaVoiceTTS *tts = [[DaVoiceTTS alloc] initWithModel:modelURL error:&error];
|
|
203
|
-
if (error || !tts) {
|
|
204
|
-
reject(@"init_failed", error.localizedDescription ?: @"Failed to initialize", error);
|
|
242
|
+
[self resolveModelURLFromPathOrURL:modelPath completion:^(NSURL *modelURL) {
|
|
243
|
+
if (!modelURL) {
|
|
244
|
+
reject(@"bad_model", [NSString stringWithFormat:@"Could not resolve model path: %@", modelPath], nil);
|
|
205
245
|
return;
|
|
206
246
|
}
|
|
207
247
|
|
|
208
|
-
dispatch_async(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
self.ttsInstance = tts;
|
|
213
|
-
|
|
214
|
-
__weak typeof(self) weakSelf = self;
|
|
215
|
-
self.ttsInstance.onLastUtteranceFinished = ^{
|
|
216
|
-
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
217
|
-
if (!strongSelf || !strongSelf.hasListeners) return;
|
|
248
|
+
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
249
|
+
NSError *error = nil;
|
|
250
|
+
DaVoiceTTS *tts = [[DaVoiceTTS alloc] initWithModel:modelURL error:&error];
|
|
251
|
+
if (error || !tts) {
|
|
218
252
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
219
|
-
|
|
253
|
+
reject(@"init_failed", error.localizedDescription ?: @"Failed to initialize", error);
|
|
220
254
|
});
|
|
221
|
-
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
222
257
|
|
|
223
|
-
|
|
258
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
259
|
+
if (self.ttsInstance) {
|
|
260
|
+
@try { [self.ttsInstance stopSpeaking]; [self.ttsInstance destroy]; } @catch (__unused id e) {}
|
|
261
|
+
}
|
|
262
|
+
self.ttsInstance = tts;
|
|
263
|
+
|
|
264
|
+
__weak typeof(self) weakSelf = self;
|
|
265
|
+
self.ttsInstance.onLastUtteranceFinished = ^{
|
|
266
|
+
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
267
|
+
if (!strongSelf || !strongSelf.hasListeners) return;
|
|
268
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
269
|
+
[strongSelf sendEventWithName:@"onFinishedSpeaking" body:@{}];
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
resolve(@"TTS initialized");
|
|
274
|
+
});
|
|
224
275
|
});
|
|
225
276
|
});
|
|
226
277
|
}
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>DavoiceTTS.framework/DavoiceTTS</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>DavoiceTTS.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
-
<string>x86_64</string>
|
|
18
17
|
</array>
|
|
19
18
|
<key>SupportedPlatform</key>
|
|
20
19
|
<string>ios</string>
|
|
21
|
-
<key>SupportedPlatformVariant</key>
|
|
22
|
-
<string>simulator</string>
|
|
23
20
|
</dict>
|
|
24
21
|
<dict>
|
|
25
22
|
<key>BinaryPath</key>
|
|
26
23
|
<string>DavoiceTTS.framework/DavoiceTTS</string>
|
|
27
24
|
<key>LibraryIdentifier</key>
|
|
28
|
-
<string>ios-
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
29
26
|
<key>LibraryPath</key>
|
|
30
27
|
<string>DavoiceTTS.framework</string>
|
|
31
28
|
<key>SupportedArchitectures</key>
|
|
32
29
|
<array>
|
|
33
30
|
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
34
32
|
</array>
|
|
35
33
|
<key>SupportedPlatform</key>
|
|
36
34
|
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
@@ -317,6 +317,29 @@ SWIFT_CLASS("_TtC10DavoiceTTS25DaVoiceAudioRoutingConfig")
|
|
|
317
317
|
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
|
318
318
|
@end
|
|
319
319
|
|
|
320
|
+
@class AVAudioSession;
|
|
321
|
+
/// Echo cancellation for iPhones WITHOUT Apple’s session-level echo-cancelled
|
|
322
|
+
/// input (<code>AVAudioSession.isEchoCancelledInputAvailable</code>, iOS 18.2+ on
|
|
323
|
+
/// supported hardware). On those devices AEC only exists inside an
|
|
324
|
+
/// AVAudioEngine with voice processing on, and it only cancels audio played
|
|
325
|
+
/// through that same engine – so TTS must play through the engine whose mic
|
|
326
|
+
/// input the listener (wake word) hears. See pocketTTS/AECSupportIOS.md.
|
|
327
|
+
/// Nothing here runs on devices WITH session-level AEC, or when AEC isn’t
|
|
328
|
+
/// requested: every caller then takes its exact pre-existing path.
|
|
329
|
+
SWIFT_CLASS("_TtC10DavoiceTTS16DaVoiceLegacyAEC")
|
|
330
|
+
@interface DaVoiceLegacyAEC : NSObject
|
|
331
|
+
/// Kill switch for the old-iPhone fallback (default true).
|
|
332
|
+
SWIFT_CLASS_PROPERTY(@property (nonatomic, class) BOOL isEnabled;)
|
|
333
|
+
+ (BOOL)isEnabled SWIFT_WARN_UNUSED_RESULT;
|
|
334
|
+
+ (void)setIsEnabled:(BOOL)newValue;
|
|
335
|
+
/// True when this device/OS offers session-level AEC. Sticky: once seen
|
|
336
|
+
/// true in this process it stays true, so a transient route/category where
|
|
337
|
+
/// iOS reports it unavailable can never switch a newer iPhone onto the
|
|
338
|
+
/// fallback path.
|
|
339
|
+
+ (BOOL)deviceHasSessionLevelAEC:(AVAudioSession * _Nonnull)session SWIFT_WARN_UNUSED_RESULT;
|
|
340
|
+
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
|
341
|
+
@end
|
|
342
|
+
|
|
320
343
|
@class NSURL;
|
|
321
344
|
@class NSUUID;
|
|
322
345
|
@class AVAudioPCMBuffer;
|