react-native-wakeword 1.1.21 → 1.1.23

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.
Files changed (31) hide show
  1. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar +0 -0
  2. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.md5 +1 -1
  3. package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.sha1 +1 -1
  4. package/android/src/main/assets/coca_cola_model_28_05052025.onnx +0 -0
  5. package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +45 -3
  6. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +4 -1
  7. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
  8. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  9. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +346 -123
  10. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +5 -3
  11. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  12. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +5 -3
  13. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +8 -2
  14. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
  15. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  16. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +346 -123
  17. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +5 -3
  18. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +5 -3
  20. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +346 -123
  21. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +5 -3
  22. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +5 -3
  24. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
  25. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
  26. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +34 -34
  27. package/ios/KeyWordRNBridge/KeyWordRNBridge.mm +64 -0
  28. package/ios/KeyWordRNBridge/models/coca_cola_model_28_05052025.onnx +0 -0
  29. package/package.json +1 -1
  30. package/wakewords/KeyWordRNBridge.d.ts +2 -0
  31. package/wakewords/KeyWordRNBridge.js +28 -1
@@ -1 +1 @@
1
- f0c6b698ac8128dea7ed4b2e185803cf keyworddetection-1.0.0.aar
1
+ 242fd5d8abf272c859876e8feedf9b25 keyworddetection-1.0.0.aar
@@ -1 +1 @@
1
- fbd4668154d96ea9b1a44aba0e13ee86fa22f011 keyworddetection-1.0.0.aar
1
+ 81899057fc9b8e6530041753e8ddd5802ea82843 keyworddetection-1.0.0.aar
@@ -42,6 +42,46 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
42
42
  promise.resolve(isLicesed);
43
43
  }
44
44
 
45
+ // Create a new instance efficiently
46
+ @ReactMethod
47
+ public void createInstanceMulti(String instanceId, ReadableArray modelPathsArray, ReadableArray thresholdsArray, ReadableArray bufferCntsArray, ReadableArray msBetweenCallbackArray, Promise promise) {
48
+ if (instances.containsKey(instanceId)) {
49
+ promise.reject("InstanceExists", "Instance already exists with ID: " + instanceId);
50
+ return;
51
+ }
52
+
53
+ try {
54
+ int size = modelPathsArray.size();
55
+ if (thresholdsArray.size() != size || bufferCntsArray.size() != size || msBetweenCallbackArray.size() != size) {
56
+ promise.reject("InvalidArguments", "All input arrays must be the same length.");
57
+ return;
58
+ }
59
+
60
+ // Convert ReadableArrays to Java arrays
61
+ String[] modelPaths = new String[size];
62
+ float[] thresholds = new float[size];
63
+ int[] bufferCnts = new int[size];
64
+ long[] msBetweenCallback = new long[size];
65
+
66
+ for (int i = 0; i < size; i++) {
67
+ modelPaths[i] = modelPathsArray.getString(i);
68
+ thresholds[i] = (float) thresholdsArray.getDouble(i);
69
+ bufferCnts[i] = bufferCntsArray.getInt(i);
70
+ msBetweenCallback[i] = (long) msBetweenCallbackArray.getDouble(i); // RN uses Double for all numbers
71
+ }
72
+
73
+ // Create instance
74
+ KeyWordsDetection keyWordsDetection = new KeyWordsDetection(reactContext, modelPaths, thresholds, bufferCnts, msBetweenCallback);
75
+ keyWordsDetection.initialize((detected, modelName) -> onKeywordDetected(instanceId, detected, modelName));
76
+
77
+ instances.put(instanceId, keyWordsDetection);
78
+ promise.resolve("Multi-model instance created with ID: " + instanceId);
79
+
80
+ } catch (Exception e) {
81
+ promise.reject("CreateError", "Failed to create multi-model instance: " + e.getMessage());
82
+ }
83
+ }
84
+
45
85
  // Create a new instance
46
86
  @ReactMethod
47
87
  public void createInstance(String instanceId, String modelName, float threshold, int bufferCnt, Promise promise) {
@@ -52,7 +92,8 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
52
92
 
53
93
  try {
54
94
  KeyWordsDetection keyWordsDetection = new KeyWordsDetection(reactContext, modelName, threshold, bufferCnt);
55
- keyWordsDetection.initialize(detected -> onKeywordDetected(instanceId, detected));
95
+ keyWordsDetection.initialize((detected, ignored) -> onKeywordDetected(instanceId, detected, modelName));
96
+
56
97
  instances.put(instanceId, keyWordsDetection);
57
98
  promise.resolve("Instance created with ID: " + instanceId);
58
99
  } catch (Exception e) {
@@ -154,11 +195,12 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
154
195
  }
155
196
 
156
197
  // Handle keyword detection event
157
- private void onKeywordDetected(String instanceId, Boolean detected) {
198
+ private void onKeywordDetected(String instanceId, boolean detected, String modelName) {
158
199
  if (detected) {
159
200
  WritableMap params = Arguments.createMap();
160
201
  params.putString("instanceId", instanceId);
161
- params.putString("phrase", instanceId);
202
+ params.putString("phrase", modelName);
203
+ params.putString("modelName", modelName);
162
204
  sendEvent("onKeywordDetectionEvent", params);
163
205
  }
164
206
  }
@@ -349,12 +349,15 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) GlobalVariab
349
349
  @end
350
350
 
351
351
  @protocol KeywordDetectionRNDelegate;
352
+ @class NSNumber;
352
353
  SWIFT_CLASS("_TtC16KeyWordDetection17KeyWordsDetection")
353
354
  @interface KeyWordsDetection : NSObject
354
355
  @property (nonatomic, weak) id <KeywordDetectionRNDelegate> _Nullable delegate;
355
356
  - (nullable instancetype)initWithModelPath:(NSString * _Nonnull)modelPath threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt error:(NSError * _Nullable * _Nullable)error;
356
- - (nullable instancetype)initWithModelPath:(NSString * _Nonnull)modelPath threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt cancelEcho:(BOOL)cancelEcho error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
357
+ - (nullable instancetype)initWithModelPaths:(NSArray<NSString *> * _Nonnull)modelPaths thresholds:(NSArray<NSNumber *> * _Nonnull)thresholds bufferCnts:(NSArray<NSNumber *> * _Nonnull)bufferCnts msBetweenCallback:(NSArray<NSNumber *> * _Nonnull)msBetweenCallback error:(NSError * _Nullable * _Nullable)error;
358
+ - (nullable instancetype)initWithModelPaths:(NSArray<NSString *> * _Nonnull)modelPaths thresholds:(NSArray<NSNumber *> * _Nonnull)thresholds bufferCnts:(NSArray<NSNumber *> * _Nonnull)bufferCnts msBetweenCallback:(NSArray<NSNumber *> * _Nonnull)msBetweenCallback cancelEcho:(BOOL)cancelEcho error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
357
359
  - (BOOL)replaceKeywordDetectionModelWithModelPath:(NSString * _Nonnull)modelPath threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt error:(NSError * _Nullable * _Nullable)error;
360
+ - (BOOL)replaceKeywordDetectionModelsWithModelPaths:(NSArray<NSString *> * _Nonnull)modelPaths thresholds:(NSArray<NSNumber *> * _Nonnull)thresholds bufferCnts:(NSArray<NSNumber *> * _Nonnull)bufferCnts msBetweenCallback:(NSArray<NSNumber *> * _Nonnull)msBetweenCallback error:(NSError * _Nullable * _Nullable)error;
358
361
  - (NSString * _Nonnull)getKeywordDetectionModel SWIFT_WARN_UNUSED_RESULT;
359
362
  - (NSString * _Nonnull)getRecordingWav SWIFT_WARN_UNUSED_RESULT;
360
363
  - (BOOL)setKeywordDetectionLicenseWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;