react-native-wakeword 1.1.22 → 1.1.24

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 (23) 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/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +6 -0
  5. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  6. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +309 -68
  7. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +7 -1
  8. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +7 -1
  9. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +12 -0
  10. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  11. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +309 -68
  12. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +7 -1
  13. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
  14. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +309 -68
  15. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +7 -1
  16. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +7 -1
  17. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
  18. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
  19. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +27 -27
  20. package/ios/KeyWordRNBridge/KeyWordRNBridge.mm +82 -1
  21. package/package.json +1 -1
  22. package/wakewords/KeyWordRNBridge.d.ts +13 -0
  23. package/wakewords/KeyWordRNBridge.js +63 -1
@@ -50,7 +50,7 @@ public class AVAudioWrapperFrameListener {
50
50
  public func removeFrameListener(_ listener: KeyWordDetection.AVAudioWrapperFrameListener)
51
51
  public func clearFrameListeners()
52
52
  public func setSessionOptions(sessionOptions: AVFAudio.AVAudioSession.CategoryOptions)
53
- public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32)
53
+ public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32, setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true)
54
54
  public func stop() throws
55
55
  @objc deinit
56
56
  }
@@ -117,6 +117,12 @@ public class AVAudioWrapper {
117
117
  @objc public func callBack(frame: [Swift.Float])
118
118
  @objc public func startListening(setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true) -> Swift.Bool
119
119
  @objc public func stopListening()
120
+ @objc public func getVoiceProps() -> [Swift.String : Any]
121
+ @objc public func startSilentListening() -> Swift.Bool
122
+ @objc public func startVADListening() -> Swift.Bool
123
+ @objc public func setVADParams(threshold: Swift.Float, msWindow: Swift.Int) throws
124
+ @objc public func stopSilentListening()
125
+ @objc public func stopVADListening()
120
126
  @objc deinit
121
127
  }
122
128
  @_inheritsConvenienceInitializers @objc public class AudioSessionAndDuckingManager : ObjectiveC.NSObject {
@@ -50,7 +50,7 @@ public class AVAudioWrapperFrameListener {
50
50
  public func removeFrameListener(_ listener: KeyWordDetection.AVAudioWrapperFrameListener)
51
51
  public func clearFrameListeners()
52
52
  public func setSessionOptions(sessionOptions: AVFAudio.AVAudioSession.CategoryOptions)
53
- public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32)
53
+ public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32, setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true)
54
54
  public func stop() throws
55
55
  @objc deinit
56
56
  }
@@ -117,6 +117,12 @@ public class AVAudioWrapper {
117
117
  @objc public func callBack(frame: [Swift.Float])
118
118
  @objc public func startListening(setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true) -> Swift.Bool
119
119
  @objc public func stopListening()
120
+ @objc public func getVoiceProps() -> [Swift.String : Any]
121
+ @objc public func startSilentListening() -> Swift.Bool
122
+ @objc public func startVADListening() -> Swift.Bool
123
+ @objc public func setVADParams(threshold: Swift.Float, msWindow: Swift.Int) throws
124
+ @objc public func stopSilentListening()
125
+ @objc public func stopVADListening()
120
126
  @objc deinit
121
127
  }
122
128
  @_inheritsConvenienceInitializers @objc public class AudioSessionAndDuckingManager : ObjectiveC.NSObject {
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Headers/KeyWordDetection-Swift.h</key>
8
8
  <data>
9
- 2LuxvPIzEv/mCjRCRJQR1iQMgJI=
9
+ 6XygZ46C4u+6r3fggo0oV1r6b3w=
10
10
  </data>
11
11
  <key>Headers/KeyWordDetection.h</key>
12
12
  <data>
@@ -18,11 +18,11 @@
18
18
  </data>
19
19
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
21
- BLS7GdwnCockvW92Rfk1ffxnSdc=
21
+ b3oLzoqJREn/yKvOw5es1r+hTcg=
22
22
  </data>
23
23
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
24
24
  <data>
25
- Oin84KT6uz+Dz5zyaKdFqrTHEuY=
25
+ 07wI99MsliDH1TOAQrpTSiZYFlg=
26
26
  </data>
27
27
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
28
28
  <data>
@@ -30,19 +30,19 @@
30
30
  </data>
31
31
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
32
32
  <data>
33
- Oin84KT6uz+Dz5zyaKdFqrTHEuY=
33
+ 07wI99MsliDH1TOAQrpTSiZYFlg=
34
34
  </data>
35
35
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
36
36
  <data>
37
- GPjpEF/igGhjAM0wpZyiMsndHys=
37
+ ALSSRB2zS0uKmtC8jp9c0MLGNq8=
38
38
  </data>
39
39
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
40
40
  <data>
41
- BLS7GdwnCockvW92Rfk1ffxnSdc=
41
+ b3oLzoqJREn/yKvOw5es1r+hTcg=
42
42
  </data>
43
43
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
44
44
  <data>
45
- thI3UPX8hf9jbWYqnJfUg5vy1p8=
45
+ kYTw/D8NxDb+IX0jOGzyUTAUAeM=
46
46
  </data>
47
47
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
48
48
  <data>
@@ -50,11 +50,11 @@
50
50
  </data>
51
51
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
52
52
  <data>
53
- thI3UPX8hf9jbWYqnJfUg5vy1p8=
53
+ kYTw/D8NxDb+IX0jOGzyUTAUAeM=
54
54
  </data>
55
55
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
56
56
  <data>
57
- QYCh9Gleq504mkb3Q1TYFsdTQ/E=
57
+ pujd31h2JP2C+D+N6eNpzCFk9B4=
58
58
  </data>
59
59
  <key>Modules/module.modulemap</key>
60
60
  <data>
@@ -67,11 +67,11 @@
67
67
  <dict>
68
68
  <key>hash</key>
69
69
  <data>
70
- 2LuxvPIzEv/mCjRCRJQR1iQMgJI=
70
+ 6XygZ46C4u+6r3fggo0oV1r6b3w=
71
71
  </data>
72
72
  <key>hash2</key>
73
73
  <data>
74
- PZysvYbQcZjqeW7WSVHAUa+KpiZFNPYwOWtz3z/WqLM=
74
+ Q5KZHWnw/JG8qVzE43/9H60L42nyqB4arOgFamTSxXY=
75
75
  </data>
76
76
  </dict>
77
77
  <key>Headers/KeyWordDetection.h</key>
@@ -89,22 +89,22 @@
89
89
  <dict>
90
90
  <key>hash</key>
91
91
  <data>
92
- BLS7GdwnCockvW92Rfk1ffxnSdc=
92
+ b3oLzoqJREn/yKvOw5es1r+hTcg=
93
93
  </data>
94
94
  <key>hash2</key>
95
95
  <data>
96
- rxlcsSVQPKp4oOIUhXBI6qIi0L8k5o9a6YR/wLGJusQ=
96
+ NYbfUqP47AT6pq4bYE7csmlbYTa4gJ0Oqp/htJkBBSY=
97
97
  </data>
98
98
  </dict>
99
99
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
100
100
  <dict>
101
101
  <key>hash</key>
102
102
  <data>
103
- Oin84KT6uz+Dz5zyaKdFqrTHEuY=
103
+ 07wI99MsliDH1TOAQrpTSiZYFlg=
104
104
  </data>
105
105
  <key>hash2</key>
106
106
  <data>
107
- vI9ROONuqIho451juaviLqAEtfyvhX6To4DxdUhfN8g=
107
+ DgxEXunXQ6tRBvQYRpmLkkZ8bl9RD+/mPIm7nNgNa/c=
108
108
  </data>
109
109
  </dict>
110
110
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
@@ -122,44 +122,44 @@
122
122
  <dict>
123
123
  <key>hash</key>
124
124
  <data>
125
- Oin84KT6uz+Dz5zyaKdFqrTHEuY=
125
+ 07wI99MsliDH1TOAQrpTSiZYFlg=
126
126
  </data>
127
127
  <key>hash2</key>
128
128
  <data>
129
- vI9ROONuqIho451juaviLqAEtfyvhX6To4DxdUhfN8g=
129
+ DgxEXunXQ6tRBvQYRpmLkkZ8bl9RD+/mPIm7nNgNa/c=
130
130
  </data>
131
131
  </dict>
132
132
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
133
133
  <dict>
134
134
  <key>hash</key>
135
135
  <data>
136
- GPjpEF/igGhjAM0wpZyiMsndHys=
136
+ ALSSRB2zS0uKmtC8jp9c0MLGNq8=
137
137
  </data>
138
138
  <key>hash2</key>
139
139
  <data>
140
- PGimumdKzZCu1MKnTinL1AIl92xU0z0JwNiDs0oTjVk=
140
+ 6r2hM8LsqF6k8UJ+Sxz/ttWxkKOLGq8eVlGh22rfg6A=
141
141
  </data>
142
142
  </dict>
143
143
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
144
144
  <dict>
145
145
  <key>hash</key>
146
146
  <data>
147
- BLS7GdwnCockvW92Rfk1ffxnSdc=
147
+ b3oLzoqJREn/yKvOw5es1r+hTcg=
148
148
  </data>
149
149
  <key>hash2</key>
150
150
  <data>
151
- rxlcsSVQPKp4oOIUhXBI6qIi0L8k5o9a6YR/wLGJusQ=
151
+ NYbfUqP47AT6pq4bYE7csmlbYTa4gJ0Oqp/htJkBBSY=
152
152
  </data>
153
153
  </dict>
154
154
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
155
155
  <dict>
156
156
  <key>hash</key>
157
157
  <data>
158
- thI3UPX8hf9jbWYqnJfUg5vy1p8=
158
+ kYTw/D8NxDb+IX0jOGzyUTAUAeM=
159
159
  </data>
160
160
  <key>hash2</key>
161
161
  <data>
162
- IWwaGRP2KyO5wCQ2MmsysDr6LR1qu255Oktn7QySVW4=
162
+ z2L8ZH+Wp6lOjbYCgZwqWdRqDr2pywYsMyTvOLOxJaM=
163
163
  </data>
164
164
  </dict>
165
165
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
@@ -177,22 +177,22 @@
177
177
  <dict>
178
178
  <key>hash</key>
179
179
  <data>
180
- thI3UPX8hf9jbWYqnJfUg5vy1p8=
180
+ kYTw/D8NxDb+IX0jOGzyUTAUAeM=
181
181
  </data>
182
182
  <key>hash2</key>
183
183
  <data>
184
- IWwaGRP2KyO5wCQ2MmsysDr6LR1qu255Oktn7QySVW4=
184
+ z2L8ZH+Wp6lOjbYCgZwqWdRqDr2pywYsMyTvOLOxJaM=
185
185
  </data>
186
186
  </dict>
187
187
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
188
188
  <dict>
189
189
  <key>hash</key>
190
190
  <data>
191
- QYCh9Gleq504mkb3Q1TYFsdTQ/E=
191
+ pujd31h2JP2C+D+N6eNpzCFk9B4=
192
192
  </data>
193
193
  <key>hash2</key>
194
194
  <data>
195
- /at1gZWt2gLuRLlE0RPJa4MS0AqCzd2maWvJm9gx7Ww=
195
+ gw5yH8RapuEo8QUin7FIH1ZQzd0kj0ogJ//F98Wk7mQ=
196
196
  </data>
197
197
  </dict>
198
198
  <key>Modules/module.modulemap</key>
@@ -111,7 +111,8 @@ RCT_EXPORT_MODULE();
111
111
  }
112
112
 
113
113
  - (NSArray<NSString *> *)supportedEvents {
114
- return @[@"onKeywordDetectionEvent"];
114
+ return @[@"onKeywordDetectionEvent",
115
+ @"onVADDetectionEvent"]; // NEW
115
116
  }
116
117
 
117
118
  RCT_EXPORT_METHOD(createInstanceMulti:(NSString *)instanceId
@@ -297,6 +298,86 @@ RCT_EXPORT_METHOD(getRecordingWav:(NSString *)instanceId resolver:(RCTPromiseRes
297
298
  }
298
299
  }
299
300
 
301
+ RCT_EXPORT_METHOD(getVoiceProps:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
302
+ {
303
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
304
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
305
+ if (instance) {
306
+ @try {
307
+ NSDictionary *voiceProps = [instance getVoiceProps];
308
+ NSMutableDictionary *result = [NSMutableDictionary dictionary];
309
+ result[@"error"] = voiceProps[@"error"] ?: @"No Error";
310
+ result[@"voiceProbability"] = @([voiceProps[@"voiceProbability"] floatValue]);
311
+ result[@"lastTimeHumanVoiceHeard"] = @([voiceProps[@"lastTimeHumanVoiceHeard"] longLongValue]);
312
+ resolve(result);
313
+ } @catch (NSException *exception) {
314
+ reject(@"VoicePropsError", [NSString stringWithFormat:@"Failed to get voice properties: %@", exception.reason], nil);
315
+ }
316
+ } else {
317
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
318
+ }
319
+ }
320
+
321
+ // Start/stop silent VAD (iOS only)
322
+ RCT_EXPORT_METHOD(startSilentVADDetection:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
323
+ {
324
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
325
+ if (wrapper && wrapper.keyWordsDetection) {
326
+ BOOL success = [wrapper.keyWordsDetection startSilentListening];
327
+ success ? resolve(@"Started silent VAD detection") :
328
+ reject(@"StartError", @"Failed to start silent VAD detection", nil);
329
+ } else {
330
+ reject(@"InstanceNotFound", @"No instance found", nil);
331
+ }
332
+ }
333
+
334
+ RCT_EXPORT_METHOD(stopSilentVADDetection:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
335
+ {
336
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
337
+ if (wrapper && wrapper.keyWordsDetection) {
338
+ [wrapper.keyWordsDetection stopSilentListening];
339
+ resolve(@"Stopped silent VAD detection");
340
+ } else {
341
+ reject(@"InstanceNotFound", @"No instance found", nil);
342
+ }
343
+ }
344
+
345
+ // Start/stop explicit VAD
346
+ RCT_EXPORT_METHOD(startVADDetection:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
347
+ {
348
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
349
+ if (wrapper && wrapper.keyWordsDetection) {
350
+ BOOL success = [wrapper.keyWordsDetection startVADListening];
351
+ success ? resolve(@"Started VAD detection") :
352
+ reject(@"StartError", @"Failed to start VAD detection", nil);
353
+ } else {
354
+ reject(@"InstanceNotFound", @"No instance found", nil);
355
+ }
356
+ }
357
+
358
+ RCT_EXPORT_METHOD(stopVADDetection:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
359
+ {
360
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
361
+ if (wrapper && wrapper.keyWordsDetection) {
362
+ [wrapper.keyWordsDetection stopVADListening];
363
+ resolve(@"Stopped VAD detection");
364
+ } else {
365
+ reject(@"InstanceNotFound", @"No instance found", nil);
366
+ }
367
+ }
368
+
369
+ // Runtime VAD params
370
+ RCT_EXPORT_METHOD(setVADParams:(NSString *)instanceId threshold:(float)threshold msWindow:(NSInteger)msWindow resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
371
+ {
372
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
373
+ if (wrapper && wrapper.keyWordsDetection) {
374
+ [wrapper.keyWordsDetection setVADParamsWithThreshold:threshold msWindow:msWindow];
375
+ resolve(@"VAD params updated");
376
+ } else {
377
+ reject(@"InstanceNotFound", @"No instance found", nil);
378
+ }
379
+ }
380
+
300
381
  // You can add more methods here as needed, ensuring they use the instanceId
301
382
 
302
383
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",
@@ -6,10 +6,23 @@ export class KeyWordRNBridgeInstance {
6
6
  isSticky: any;
7
7
  createInstanceMulti(modelNames: any, thresholds: any, bufferCnts: any, msBetweenCallbacks: any): Promise<any>;
8
8
  createInstance(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
9
+ getVoiceProps(): Promise<{
10
+ error: any;
11
+ voiceProbability: any;
12
+ lastTimeHumanVoiceHeard: any;
13
+ }>;
14
+ startSilentVADDetection(): Promise<any>;
15
+ stopSilentVADDetection(): Promise<any>;
16
+ startVADDetection(): Promise<any>;
17
+ stopVADDetection(): Promise<any>;
18
+ onVADDetectionEvent(callback: any): import("react-native").EmitterSubscription;
19
+ setVADParams(threshold: any, msWindow: any): Promise<any>;
20
+ getVADParams(): Promise<any>;
9
21
  setKeywordDetectionLicense(license: any): Promise<any>;
10
22
  replaceKeywordDetectionModel(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
11
23
  setKeywordLicense(license: any): Promise<any>;
12
24
  startKeywordDetection(threshold: any, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
25
+ getRecordingWav(): Promise<any>;
13
26
  stopKeywordDetection(): Promise<any>;
14
27
  destroyInstance(): Promise<any>;
15
28
  onKeywordDetectionEvent(callback: any): import("react-native").EmitterSubscription;
@@ -38,7 +38,7 @@ export class KeyWordRNBridgeInstance {
38
38
  }
39
39
 
40
40
  async createInstance(modelName, threshold, bufferCnt) {
41
- instance = await KeyWordRNBridge.createInstance(
41
+ const instance = await KeyWordRNBridge.createInstance(
42
42
  this.instanceId,
43
43
  modelName,
44
44
  threshold,
@@ -51,6 +51,63 @@ export class KeyWordRNBridgeInstance {
51
51
  return instance;
52
52
  }
53
53
 
54
+ // 1) Voice props (parity with VAD)
55
+ async getVoiceProps() {
56
+ try {
57
+ const voiceProps = await KeyWordRNBridge.getVoiceProps(this.instanceId);
58
+ return {
59
+ error: voiceProps.error,
60
+ voiceProbability: voiceProps.voiceProbability,
61
+ lastTimeHumanVoiceHeard: voiceProps.lastTimeHumanVoiceHeard,
62
+ };
63
+ } catch (error) {
64
+ console.error('Error getting voice properties:', error);
65
+ throw error;
66
+ }
67
+ }
68
+
69
+ // 2) Silent VAD control (iOS-only, optional but useful)
70
+ async startSilentVADDetection() {
71
+ if (Platform.OS === 'ios') {
72
+ return await KeyWordRNBridge.startSilentVADDetection(this.instanceId);
73
+ }
74
+ }
75
+
76
+ async stopSilentVADDetection() {
77
+ if (Platform.OS === 'ios') {
78
+ return await KeyWordRNBridge.stopSilentVADDetection(this.instanceId);
79
+ }
80
+ }
81
+
82
+ // 3) Explicit VAD start/stop (if exposed by your native bridge)
83
+ async startVADDetection() {
84
+ return await KeyWordRNBridge.startVADDetection(this.instanceId);
85
+ }
86
+ async stopVADDetection() {
87
+ return await KeyWordRNBridge.stopVADDetection(this.instanceId);
88
+ }
89
+
90
+ // 4) (Optional) VAD event listener if your native layer emits it
91
+ onVADDetectionEvent(callback) {
92
+ const listener = keywordRNBridgeEmitter.addListener('onVADDetectionEvent', (event) => {
93
+ if (event.instanceId === this.instanceId) {
94
+ callback(event.phrase);
95
+ }
96
+ });
97
+ this.listeners.push(listener);
98
+ return listener;
99
+ }
100
+
101
+ // Configure VAD runtime parameters
102
+ async setVADParams(threshold, msWindow) {
103
+ return await KeyWordRNBridge.setVADParams(this.instanceId, threshold, msWindow);
104
+ }
105
+
106
+ async getVADParams() {
107
+ // implement only if native exposes it
108
+ return await KeyWordRNBridge.getVADParams(this.instanceId);
109
+ }
110
+
54
111
  async setKeywordDetectionLicense(license) {
55
112
  return await KeyWordRNBridge.setKeywordDetectionLicense(this.instanceId, license);
56
113
  }
@@ -89,6 +146,10 @@ export class KeyWordRNBridgeInstance {
89
146
  }
90
147
  }
91
148
 
149
+ async getRecordingWav() {
150
+ return await KeyWordRNBridge.getRecordingWav(this.instanceId);
151
+ }
152
+
92
153
  async stopKeywordDetection() {
93
154
  return KeyWordRNBridge.stopKeywordDetection(this.instanceId);
94
155
  }
@@ -121,6 +182,7 @@ export class KeyWordRNBridgeInstance {
121
182
 
122
183
  export const removeAllRNBridgeListeners = async () => {
123
184
  keywordRNBridgeEmitter.removeAllListeners('onKeywordDetectionEvent');
185
+ keywordRNBridgeEmitter.removeAllListeners('onVADDetectionEvent'); // NEW
124
186
  }
125
187
 
126
188
  export const createKeyWordRNBridgeInstance = async (instanceId, isSticky) => {