react-native-davoice-tts 1.0.316 → 1.0.317
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 +133 -4
- 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 +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +8252 -8106
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +82 -80
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +82 -80
- 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 +4 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +8576 -8430
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +51 -49
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +51 -49
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +8576 -8430
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +51 -49
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +51 -49
- 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 +31 -10
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.197" # 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 .
|
|
@@ -255,6 +255,36 @@ RCT_EXPORT_MODULE(SpeechBridge)
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
- (void)waitForSTTEngineHotWithTimeoutMs:(NSNumber *)timeoutMs
|
|
259
|
+
completion:(void (^)(BOOL ok))completion
|
|
260
|
+
{
|
|
261
|
+
NSNumber *t = timeoutMs ?: @(2500);
|
|
262
|
+
if (t.doubleValue <= 0) t = @(2500);
|
|
263
|
+
|
|
264
|
+
CFTimeInterval deadline = CACurrentMediaTime() + MAX(0.1, t.doubleValue / 1000.0);
|
|
265
|
+
|
|
266
|
+
__weak typeof(self) weakSelf = self;
|
|
267
|
+
__block void (^poll)(void) = ^{
|
|
268
|
+
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
269
|
+
if (!strongSelf) {
|
|
270
|
+
completion(NO);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (strongSelf.sttEngineHot) {
|
|
274
|
+
completion(YES);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (CACurrentMediaTime() >= deadline) {
|
|
278
|
+
completion(NO);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)),
|
|
282
|
+
dispatch_get_main_queue(), poll);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
dispatch_async(dispatch_get_main_queue(), poll);
|
|
286
|
+
}
|
|
287
|
+
|
|
258
288
|
RCT_EXPORT_METHOD(hasMicPermissions:(RCTPromiseResolveBlock)resolve
|
|
259
289
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
260
290
|
{
|
|
@@ -391,10 +421,12 @@ RCT_EXPORT_METHOD(initAll:(NSDictionary *)opts
|
|
|
391
421
|
if (self.initialized) { resolve(@"already_initialized"); return; }
|
|
392
422
|
|
|
393
423
|
self.initializing = YES;
|
|
424
|
+
self.sttEngineHot = NO;
|
|
394
425
|
|
|
395
426
|
NSString *locale = opts[@"locale"] ?: @"en-US";
|
|
396
427
|
NSString *onboardingJsonPath = opts[@"onboardingJsonPath"];
|
|
397
428
|
NSString *modelPath = opts[@"model"];
|
|
429
|
+
NSNumber *timeoutMs = opts[@"timeoutMs"];
|
|
398
430
|
if (modelPath.length == 0) {
|
|
399
431
|
self.initializing = NO;
|
|
400
432
|
reject(@"invalid_args", @"Missing 'model' in initAll()", nil);
|
|
@@ -469,6 +501,7 @@ RCT_EXPORT_METHOD(initAll:(NSDictionary *)opts
|
|
|
469
501
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
470
502
|
if (err || !tts) {
|
|
471
503
|
self.initializing = NO;
|
|
504
|
+
self.sttEngineHot = NO;
|
|
472
505
|
[self.stt destroySpeech:nil];
|
|
473
506
|
self.stt = nil;
|
|
474
507
|
reject(@"tts_init_failed", err.localizedDescription ?: @"TTS init failed", err);
|
|
@@ -477,10 +510,16 @@ RCT_EXPORT_METHOD(initAll:(NSDictionary *)opts
|
|
|
477
510
|
|
|
478
511
|
self.tts = tts;
|
|
479
512
|
[self wireTTSFinishedCallback];
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
513
|
+
[self waitForSTTEngineHotWithTimeoutMs:timeoutMs completion:^(BOOL ok) {
|
|
514
|
+
if (!ok) {
|
|
515
|
+
self.initializing = NO;
|
|
516
|
+
reject(@"stt_init_timeout", @"STT did not become ready before timeout", nil);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
self.initialized = YES;
|
|
520
|
+
self.initializing = NO;
|
|
521
|
+
resolve(@"initialized");
|
|
522
|
+
}];
|
|
484
523
|
});
|
|
485
524
|
});
|
|
486
525
|
});
|
|
@@ -496,6 +535,26 @@ RCT_EXPORT_METHOD(pauseSpeechRecognitionLite:(RCTResponseSenderBlock)callback)
|
|
|
496
535
|
if (callback) callback(@[@(YES)]);
|
|
497
536
|
}
|
|
498
537
|
|
|
538
|
+
RCT_EXPORT_METHOD(pauseSpeechRecognitionLiteAsync:(nonnull NSNumber *)timeoutMs
|
|
539
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
540
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
541
|
+
{
|
|
542
|
+
if (!self.stt) { resolve(@{@"ok": @(YES), @"reason": @""}); return; }
|
|
543
|
+
|
|
544
|
+
NSNumber *t = timeoutMs ?: @(1500);
|
|
545
|
+
if (t.doubleValue <= 0) t = @(1500);
|
|
546
|
+
|
|
547
|
+
if ([(id)self.stt respondsToSelector:@selector(pauseSpeechRecognitionLiteAndWait:completion:)]) {
|
|
548
|
+
[(id)self.stt pauseSpeechRecognitionLiteAndWait:t completion:^(BOOL ok, NSString * _Nullable reason) {
|
|
549
|
+
resolve(@{@"ok": @(ok), @"reason": reason ?: @""});
|
|
550
|
+
}];
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
[self.stt pauseSpeechRecognitionLite];
|
|
555
|
+
resolve(@{@"ok": @(YES), @"reason": @"bridge_fallback_no_wait_method"});
|
|
556
|
+
}
|
|
557
|
+
|
|
499
558
|
RCT_EXPORT_METHOD(unPauseSpeechRecognitionLite:(nonnull NSNumber *)times
|
|
500
559
|
callback:(RCTResponseSenderBlock)callback)
|
|
501
560
|
{
|
|
@@ -529,6 +588,34 @@ RCT_EXPORT_METHOD(unPauseSpeechRecognitionLiteWithPreFetch:(nonnull NSNumber *)t
|
|
|
529
588
|
SBLog(@"unPauseSpeechRecognitionLiteWithPreFetch CALLBACK fired times=%@ preFetchMs=%@", times, preFetch);
|
|
530
589
|
}
|
|
531
590
|
|
|
591
|
+
RCT_EXPORT_METHOD(unPauseSpeechRecognitionLiteAsync:(nonnull NSNumber *)times
|
|
592
|
+
preFetchMs:(nonnull NSNumber *)preFetch
|
|
593
|
+
timeoutMs:(nonnull NSNumber *)timeoutMs
|
|
594
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
595
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
596
|
+
{
|
|
597
|
+
SBLog(@"unPauseSpeechRecognitionLiteAsync ENTER times=%@ preFetchMs=%@ timeoutMs=%@", times, preFetch, timeoutMs);
|
|
598
|
+
if (!self.stt) { resolve(@{@"ok": @(YES), @"reason": @""}); return; }
|
|
599
|
+
|
|
600
|
+
NSNumber *t = timeoutMs ?: @(2500);
|
|
601
|
+
if (t.doubleValue <= 0) t = @(2500);
|
|
602
|
+
NSNumber *pf = preFetch ?: @(0);
|
|
603
|
+
if (pf.doubleValue < 0) pf = @(0);
|
|
604
|
+
|
|
605
|
+
if ([(id)self.stt respondsToSelector:@selector(unPauseSpeechRecognitionLiteAndWait:preFetch:timeoutMs:completion:)]) {
|
|
606
|
+
[(id)self.stt unPauseSpeechRecognitionLiteAndWait:times
|
|
607
|
+
preFetch:pf
|
|
608
|
+
timeoutMs:t
|
|
609
|
+
completion:^(BOOL ok, NSString * _Nullable reason) {
|
|
610
|
+
resolve(@{@"ok": @(ok), @"reason": reason ?: @""});
|
|
611
|
+
}];
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
[self.stt unPauseSpeechRecognitionLite:times preFetch:pf];
|
|
616
|
+
resolve(@{@"ok": @(YES), @"reason": @"bridge_fallback_no_wait_method"});
|
|
617
|
+
}
|
|
618
|
+
|
|
532
619
|
// Promise-based pause that resolves ONLY when iOS is actually settled in playback (mic released)
|
|
533
620
|
RCT_EXPORT_METHOD(pauseMicrophoneAsync:(nonnull NSNumber *)timeoutMs
|
|
534
621
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
@@ -597,6 +684,7 @@ RCT_EXPORT_METHOD(destroyAll:(RCTPromiseResolveBlock)resolve
|
|
|
597
684
|
@try { [self.stt destroySpeech:nil]; } @catch (__unused id e) {}
|
|
598
685
|
self.stt = nil;
|
|
599
686
|
|
|
687
|
+
self.sttEngineHot = NO;
|
|
600
688
|
self.initialized = NO;
|
|
601
689
|
self.initializing = NO;
|
|
602
690
|
resolve(@"destroyed");
|
|
@@ -609,15 +697,34 @@ RCT_EXPORT_METHOD(startSpeech:(NSString *)locale
|
|
|
609
697
|
callback:(RCTResponseSenderBlock)callback)
|
|
610
698
|
{
|
|
611
699
|
[self ensureSTT];
|
|
700
|
+
self.sttEngineHot = NO;
|
|
612
701
|
[self.stt startSpeechWithLocaleStr:locale];
|
|
613
702
|
if (callback) callback(@[@(NO)]);
|
|
614
703
|
}
|
|
615
704
|
|
|
705
|
+
RCT_EXPORT_METHOD(startSpeechAsync:(NSString *)locale
|
|
706
|
+
timeoutMs:(nonnull NSNumber *)timeoutMs
|
|
707
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
708
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
709
|
+
{
|
|
710
|
+
[self ensureSTT];
|
|
711
|
+
self.sttEngineHot = NO;
|
|
712
|
+
[self.stt startSpeechWithLocaleStr:locale];
|
|
713
|
+
[self waitForSTTEngineHotWithTimeoutMs:timeoutMs completion:^(BOOL ok) {
|
|
714
|
+
if (!ok) {
|
|
715
|
+
reject(@"stt_start_timeout", @"STT did not become ready before timeout", nil);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
resolve(@{@"ok": @(YES)});
|
|
719
|
+
}];
|
|
720
|
+
}
|
|
721
|
+
|
|
616
722
|
RCT_EXPORT_METHOD(startSpeechWithSVOnboardingJson:(NSString *)locale
|
|
617
723
|
onboardingJsonPath:(NSString *)onboardingJsonPath
|
|
618
724
|
callback:(RCTResponseSenderBlock)callback)
|
|
619
725
|
{
|
|
620
726
|
[self ensureSTT];
|
|
727
|
+
self.sttEngineHot = NO;
|
|
621
728
|
if (onboardingJsonPath && (id)onboardingJsonPath != [NSNull null] && onboardingJsonPath.length > 0) {
|
|
622
729
|
[self.stt startSpeechWithLocaleStr:locale onboardingJsonPath:onboardingJsonPath];
|
|
623
730
|
} else {
|
|
@@ -626,6 +733,28 @@ RCT_EXPORT_METHOD(startSpeechWithSVOnboardingJson:(NSString *)locale
|
|
|
626
733
|
if (callback) callback(@[@(NO)]);
|
|
627
734
|
}
|
|
628
735
|
|
|
736
|
+
RCT_EXPORT_METHOD(startSpeechWithSVOnboardingJsonAsync:(NSString *)locale
|
|
737
|
+
onboardingJsonPath:(NSString *)onboardingJsonPath
|
|
738
|
+
timeoutMs:(nonnull NSNumber *)timeoutMs
|
|
739
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
740
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
741
|
+
{
|
|
742
|
+
[self ensureSTT];
|
|
743
|
+
self.sttEngineHot = NO;
|
|
744
|
+
if (onboardingJsonPath && (id)onboardingJsonPath != [NSNull null] && onboardingJsonPath.length > 0) {
|
|
745
|
+
[self.stt startSpeechWithLocaleStr:locale onboardingJsonPath:onboardingJsonPath];
|
|
746
|
+
} else {
|
|
747
|
+
[self.stt startSpeechWithLocaleStr:locale];
|
|
748
|
+
}
|
|
749
|
+
[self waitForSTTEngineHotWithTimeoutMs:timeoutMs completion:^(BOOL ok) {
|
|
750
|
+
if (!ok) {
|
|
751
|
+
reject(@"stt_start_timeout", @"STT did not become ready before timeout", nil);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
resolve(@{@"ok": @(YES)});
|
|
755
|
+
}];
|
|
756
|
+
}
|
|
757
|
+
|
|
629
758
|
RCT_EXPORT_METHOD(stopSpeech:(RCTResponseSenderBlock)callback)
|
|
630
759
|
{
|
|
631
760
|
if (!self.stt) { if (callback) callback(@[@(NO)]); return; }
|
|
@@ -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_x86_64-simulator</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>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>DavoiceTTS.framework/DavoiceTTS</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>DavoiceTTS.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
@@ -361,8 +361,10 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSStri
|
|
|
361
361
|
+ (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
|
|
362
362
|
- (BOOL)setLicenseWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;
|
|
363
363
|
- (void)pauseSpeechRecognitionLite;
|
|
364
|
+
- (void)pauseSpeechRecognitionLiteAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
364
365
|
- (void)unPauseSpeechRecognitionLite:(NSNumber * _Nonnull)times;
|
|
365
366
|
- (void)unPauseSpeechRecognitionLite:(NSNumber * _Nonnull)times preFetch:(NSNumber * _Nonnull)preFetch;
|
|
367
|
+
- (void)unPauseSpeechRecognitionLiteAndWait:(NSNumber * _Nonnull)times preFetch:(NSNumber * _Nonnull)preFetch timeoutMs:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
366
368
|
- (void)pauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
367
369
|
- (void)unPauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
368
370
|
- (void)pauseMicrophone;
|