react-native-wakeword 1.1.24 → 1.1.26

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.
@@ -366,16 +366,28 @@ RCT_EXPORT_METHOD(stopVADDetection:(NSString *)instanceId resolver:(RCTPromiseRe
366
366
  }
367
367
  }
368
368
 
369
- // Runtime VAD params
370
- RCT_EXPORT_METHOD(setVADParams:(NSString *)instanceId threshold:(float)threshold msWindow:(NSInteger)msWindow resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
369
+ RCT_EXPORT_METHOD(setVADParams:(NSString *)instanceId
370
+ threshold:(float)threshold
371
+ msWindow:(NSInteger)msWindow
372
+ resolver:(RCTPromiseResolveBlock)resolve
373
+ rejecter:(RCTPromiseRejectBlock)reject)
371
374
  {
372
- KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
373
- if (wrapper && wrapper.keyWordsDetection) {
374
- [wrapper.keyWordsDetection setVADParamsWithThreshold:threshold msWindow:msWindow];
375
- resolve(@"VAD params updated");
375
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
376
+ if (wrapper && wrapper.keyWordsDetection) {
377
+ NSError *err = nil;
378
+ BOOL ok = [wrapper.keyWordsDetection setVADParamsWithThreshold:threshold
379
+ msWindow:msWindow
380
+ error:&err];
381
+ if (!ok || err) {
382
+ reject(@"VADParamsError",
383
+ err ? err.localizedDescription : @"Failed to set VAD params",
384
+ err);
376
385
  } else {
377
- reject(@"InstanceNotFound", @"No instance found", nil);
386
+ resolve(@"VAD params updated");
378
387
  }
388
+ } else {
389
+ reject(@"InstanceNotFound", @"No instance found", nil);
390
+ }
379
391
  }
380
392
 
381
393
  // You can add more methods here as needed, ensuring they use the instanceId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",