react-native-wakeword 1.1.59 → 1.1.61

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.
@@ -1 +1 @@
1
- 4aa9fcc3263f94da6f26d70e024edb55 keyworddetection-1.0.0.aar
1
+ 06c4ab214cb57c965e94da52f395ded9 keyworddetection-1.0.0.aar
@@ -1 +1 @@
1
- 1b46b16ef432495c4ac34228799b65d6cc060b92 keyworddetection-1.0.0.aar
1
+ 223decc5c721fd9a5fa69a7790c16d1c3eecbecd keyworddetection-1.0.0.aar
@@ -154,6 +154,7 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
154
154
  String recordingWav = "";
155
155
  if (instance == null) {
156
156
  promise.reject("Instance not Exists", "Instance does not exists with ID: " + instanceId);
157
+ return;
157
158
  }
158
159
  try {
159
160
  recordingWav = instance.getRecordingWav();
@@ -163,6 +164,27 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
163
164
  }
164
165
  }
165
166
 
167
+ @ReactMethod
168
+ public void getRecordingWavArray(String instanceId, Promise promise) {
169
+ KeyWordsDetection instance = instances.get(instanceId);
170
+ if (instance == null) {
171
+ promise.reject("Instance not Exists", "Instance does not exists with ID: " + instanceId);
172
+ return;
173
+ }
174
+ try {
175
+ String[] recordingWavs = instance.getRecordingWavArray();
176
+ WritableArray out = Arguments.createArray();
177
+ if (recordingWavs != null) {
178
+ for (String recordingWav : recordingWavs) {
179
+ out.pushString(recordingWav);
180
+ }
181
+ }
182
+ promise.resolve(out);
183
+ } catch (Exception e) {
184
+ promise.reject("GetRecordingWavArrayError", "Failed to get recording WAV array: " + e.getMessage());
185
+ }
186
+ }
187
+
166
188
  // Create a new instance
167
189
  @ReactMethod
168
190
  public void replaceKeywordDetectionModel(String instanceId, String modelName, float threshold, int bufferCnt, Promise promise) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.1.59",
3
+ "version": "1.1.61",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",
@@ -22,6 +22,7 @@ export class KeyWordRNBridgeInstance {
22
22
  replaceKeywordDetectionModel(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
23
23
  setKeywordLicense(license: any): Promise<any>;
24
24
  startKeywordDetection(threshold: any, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
25
+ getRecordingWavArray(): Promise<any>;
25
26
  getRecordingWav(): Promise<any>;
26
27
  stopKeywordDetection(): Promise<any>;
27
28
  destroyInstance(): Promise<any>;
@@ -146,6 +146,10 @@ export class KeyWordRNBridgeInstance {
146
146
  }
147
147
  }
148
148
 
149
+ async getRecordingWavArray() {
150
+ return await KeyWordRNBridge.getRecordingWavArray(this.instanceId);
151
+ }
152
+
149
153
  async getRecordingWav() {
150
154
  return await KeyWordRNBridge.getRecordingWav(this.instanceId);
151
155
  }
@@ -39,7 +39,7 @@ export class SpeakerVerificationMicController {
39
39
  finalizeOnboardingNow(): Promise<any>;
40
40
  setEnrollmentJson(enrollmentJson: any): Promise<any>;
41
41
  startVerifyFromMic(resetState?: boolean): Promise<any>;
42
- startEndlessVerifyFromMic(hopSeconds?: number, stopOnMatch?: boolean): Promise<any>;
42
+ startEndlessVerifyFromMic(hopSeconds?: number, stopOnMatch?: boolean, resetState?: boolean): Promise<any>;
43
43
  stop(): Promise<any>;
44
44
  destroy(): Promise<any>;
45
45
  }
@@ -199,9 +199,20 @@ export class SpeakerVerificationMicController {
199
199
  );
200
200
  }
201
201
 
202
- async startEndlessVerifyFromMic(hopSeconds = 0.5, stopOnMatch = false) {
202
+ async startEndlessVerifyFromMic(hopSeconds = 0.5, stopOnMatch = false, resetState = true) {
203
203
  assertMethod('svStartEndlessVerifyFromMic');
204
- dbg('svStartEndlessVerifyFromMic args:', { controllerId: this.controllerId, hopSeconds, stopOnMatch });
204
+ dbg('svStartEndlessVerifyFromMic args:', { controllerId: this.controllerId, hopSeconds, stopOnMatch, resetState: !!resetState });
205
+
206
+ if (Platform.OS === 'android') {
207
+ return await KeyWordRNBridge.svStartEndlessVerifyFromMic(
208
+ this.controllerId,
209
+ Number(hopSeconds),
210
+ !!stopOnMatch,
211
+ !!resetState
212
+ );
213
+ }
214
+
215
+ // iOS bridge currently expects 3 JS args (controllerId, hopSeconds, stopOnMatch)
205
216
  return await KeyWordRNBridge.svStartEndlessVerifyFromMic(
206
217
  this.controllerId,
207
218
  Number(hopSeconds),