react-native-wakeword 1.1.69 → 1.1.70

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
- e3ed3e2d1e4f0fdf290f0974d23eb8aa keyworddetection-1.0.0.aar
1
+ 7d4c3a558c778d6680100e99ffaf47a4 keyworddetection-1.0.0.aar
@@ -1 +1 @@
1
- ac32d0a227f675731ec7ef3aa4c5943ac00c5a68 keyworddetection-1.0.0.aar
1
+ 5665687359d31955083b51b1062dc19507b873ed keyworddetection-1.0.0.aar
@@ -204,11 +204,15 @@ public class KeyWordRNBridge extends ReactContextBaseJavaModule {
204
204
 
205
205
  // Start detection for a specific instance
206
206
  @ReactMethod
207
- public void startKeywordDetection(String instanceId, float threshold, Promise promise) {
207
+ public void startKeywordDetection(String instanceId, float threshold, @Nullable String speakerVerificationEnrollmentJsonOrPath, Promise promise) {
208
208
  KeyWordsDetection instance = instances.get(instanceId);
209
209
  if (instance != null) {
210
- instance.startListening(threshold);
211
- promise.resolve("Started detection for instance: " + instanceId);
210
+ try {
211
+ instance.startListening(threshold, speakerVerificationEnrollmentJsonOrPath);
212
+ promise.resolve("Started detection for instance: " + instanceId);
213
+ } catch (Exception e) {
214
+ promise.reject("StartDetectionError", "Failed to start detection: " + e.getMessage());
215
+ }
212
216
  } else {
213
217
  promise.reject("InstanceNotFound", "No instance found with ID: " + instanceId);
214
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.1.69",
3
+ "version": "1.1.70",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",
@@ -21,7 +21,7 @@ export class KeyWordRNBridgeInstance {
21
21
  setKeywordDetectionLicense(license: any): Promise<any>;
22
22
  replaceKeywordDetectionModel(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
23
23
  setKeywordLicense(license: any): Promise<any>;
24
- startKeywordDetection(threshold: any, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
24
+ startKeywordDetection(threshold: any, speakerVerificationEnrollmentJsonOrPathOrSetActive?: null, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
25
25
  getRecordingWavArray(): Promise<any>;
26
26
  getRecordingWav(): Promise<any>;
27
27
  stopKeywordDetection(): Promise<any>;
@@ -32,6 +32,8 @@ export class KeyWordRNBridgeInstance {
32
32
  removeListeners(): void;
33
33
  }
34
34
  export function removeAllRNBridgeListeners(): Promise<void>;
35
+ export function pauseDetection(instanceId: any, stopMic?: boolean): Promise<any>;
36
+ export function unPauseDetection(instanceId: any): Promise<any>;
35
37
  export function createKeyWordRNBridgeInstance(instanceId: any, isSticky: any): Promise<KeyWordRNBridgeInstance>;
36
38
  export function enableDucking(): Promise<void>;
37
39
  export function disableDucking(): Promise<void>;
@@ -126,23 +126,44 @@ export class KeyWordRNBridgeInstance {
126
126
  return KeyWordRNBridge.setKeywordLicense(this.instanceId, license);
127
127
  }
128
128
 
129
- async startKeywordDetection(threshold,
129
+ async startKeywordDetection(
130
+ threshold,
131
+ speakerVerificationEnrollmentJsonOrPathOrSetActive = null,
130
132
  setActive = true,
131
133
  duckOthers = false,
132
134
  mixWithOthers = true,
133
- defaultToSpeaker = true) {
135
+ defaultToSpeaker = true
136
+ ) {
137
+ let speakerVerificationEnrollmentJsonOrPath = null;
138
+
139
+ if (
140
+ typeof speakerVerificationEnrollmentJsonOrPathOrSetActive === 'string' ||
141
+ speakerVerificationEnrollmentJsonOrPathOrSetActive == null
142
+ ) {
143
+ speakerVerificationEnrollmentJsonOrPath = speakerVerificationEnrollmentJsonOrPathOrSetActive;
144
+ } else {
145
+ defaultToSpeaker = mixWithOthers;
146
+ mixWithOthers = duckOthers;
147
+ duckOthers = setActive;
148
+ setActive = speakerVerificationEnrollmentJsonOrPathOrSetActive;
149
+ }
134
150
 
135
151
  if (Platform.OS === 'ios') {
136
152
  return KeyWordRNBridge.startKeywordDetection(
137
153
  this.instanceId,
138
154
  threshold,
155
+ speakerVerificationEnrollmentJsonOrPath,
139
156
  setActive,
140
157
  duckOthers,
141
158
  mixWithOthers,
142
159
  defaultToSpeaker
143
160
  );
144
161
  } else {
145
- return KeyWordRNBridge.startKeywordDetection(this.instanceId, threshold);
162
+ return KeyWordRNBridge.startKeywordDetection(
163
+ this.instanceId,
164
+ threshold,
165
+ speakerVerificationEnrollmentJsonOrPath
166
+ );
146
167
  }
147
168
  }
148
169
 
@@ -197,6 +218,14 @@ export const removeAllRNBridgeListeners = async () => {
197
218
  keywordRNBridgeEmitter.removeAllListeners('onVADDetectionEvent'); // NEW
198
219
  }
199
220
 
221
+ export const pauseDetection = async (instanceId, stopMic = false) => {
222
+ return KeyWordRNBridge.pauseDetection(instanceId, stopMic);
223
+ };
224
+
225
+ export const unPauseDetection = async (instanceId) => {
226
+ return KeyWordRNBridge.unPauseDetection(instanceId);
227
+ };
228
+
200
229
  export const createKeyWordRNBridgeInstance = async (instanceId, isSticky) => {
201
230
  return await new KeyWordRNBridgeInstance(instanceId, isSticky);
202
231
  };
@@ -3,6 +3,8 @@ import { enableDucking } from './KeyWordRNBridge';
3
3
  import { disableDucking } from './KeyWordRNBridge';
4
4
  import { initAudioSessAndDuckManage } from './KeyWordRNBridge';
5
5
  import { restartListeningAfterDucking } from './KeyWordRNBridge';
6
+ import { pauseDetection } from './KeyWordRNBridge';
7
+ import { unPauseDetection } from './KeyWordRNBridge';
6
8
  import { removeAllRNBridgeListeners } from './KeyWordRNBridge';
7
9
  import { createKeyWordRNBridgeInstance } from './KeyWordRNBridge';
8
10
  import { KeyWordRNBridgeInstance } from './KeyWordRNBridge';