react-native-wakeword 1.1.69 → 1.1.71
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.
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar +0 -0
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.md5 +1 -1
- package/android/libs/com/davoice/keyworddetection/1.0.0/keyworddetection-1.0.0.aar.sha1 +1 -1
- package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +7 -3
- package/package.json +1 -1
- package/wakewords/KeyWordRNBridge.d.ts +11 -1
- package/wakewords/KeyWordRNBridge.js +41 -3
- package/wakewords/index.d.ts +2 -0
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7d4c3a558c778d6680100e99ffaf47a4 keyworddetection-1.0.0.aar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
211
|
-
|
|
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
|
@@ -21,7 +21,15 @@ 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
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @param {any} threshold
|
|
26
|
+
* @param {string | undefined} [speakerVerificationEnrollmentJsonOrPathOrSetActive]
|
|
27
|
+
* @param {boolean} [setActive]
|
|
28
|
+
* @param {boolean} [duckOthers]
|
|
29
|
+
* @param {boolean} [mixWithOthers]
|
|
30
|
+
* @param {boolean} [defaultToSpeaker]
|
|
31
|
+
*/
|
|
32
|
+
startKeywordDetection(threshold: any, speakerVerificationEnrollmentJsonOrPathOrSetActive?: string | undefined, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
|
|
25
33
|
getRecordingWavArray(): Promise<any>;
|
|
26
34
|
getRecordingWav(): Promise<any>;
|
|
27
35
|
stopKeywordDetection(): Promise<any>;
|
|
@@ -32,6 +40,8 @@ export class KeyWordRNBridgeInstance {
|
|
|
32
40
|
removeListeners(): void;
|
|
33
41
|
}
|
|
34
42
|
export function removeAllRNBridgeListeners(): Promise<void>;
|
|
43
|
+
export function pauseDetection(instanceId: any, stopMic?: boolean): Promise<any>;
|
|
44
|
+
export function unPauseDetection(instanceId: any): Promise<any>;
|
|
35
45
|
export function createKeyWordRNBridgeInstance(instanceId: any, isSticky: any): Promise<KeyWordRNBridgeInstance>;
|
|
36
46
|
export function enableDucking(): Promise<void>;
|
|
37
47
|
export function disableDucking(): Promise<void>;
|
|
@@ -126,23 +126,53 @@ export class KeyWordRNBridgeInstance {
|
|
|
126
126
|
return KeyWordRNBridge.setKeywordLicense(this.instanceId, license);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
/**
|
|
130
|
+
* @param {any} threshold
|
|
131
|
+
* @param {string | undefined} [speakerVerificationEnrollmentJsonOrPathOrSetActive]
|
|
132
|
+
* @param {boolean} [setActive]
|
|
133
|
+
* @param {boolean} [duckOthers]
|
|
134
|
+
* @param {boolean} [mixWithOthers]
|
|
135
|
+
* @param {boolean} [defaultToSpeaker]
|
|
136
|
+
*/
|
|
137
|
+
async startKeywordDetection(
|
|
138
|
+
threshold,
|
|
139
|
+
speakerVerificationEnrollmentJsonOrPathOrSetActive = undefined,
|
|
130
140
|
setActive = true,
|
|
131
141
|
duckOthers = false,
|
|
132
142
|
mixWithOthers = true,
|
|
133
|
-
defaultToSpeaker = true
|
|
143
|
+
defaultToSpeaker = true
|
|
144
|
+
) {
|
|
145
|
+
/** @type {string | undefined} */
|
|
146
|
+
let speakerVerificationEnrollmentJsonOrPath = undefined;
|
|
147
|
+
|
|
148
|
+
if (
|
|
149
|
+
typeof speakerVerificationEnrollmentJsonOrPathOrSetActive === 'string' ||
|
|
150
|
+
speakerVerificationEnrollmentJsonOrPathOrSetActive == null
|
|
151
|
+
) {
|
|
152
|
+
speakerVerificationEnrollmentJsonOrPath = speakerVerificationEnrollmentJsonOrPathOrSetActive;
|
|
153
|
+
} else {
|
|
154
|
+
defaultToSpeaker = mixWithOthers;
|
|
155
|
+
mixWithOthers = duckOthers;
|
|
156
|
+
duckOthers = setActive;
|
|
157
|
+
setActive = speakerVerificationEnrollmentJsonOrPathOrSetActive;
|
|
158
|
+
}
|
|
134
159
|
|
|
135
160
|
if (Platform.OS === 'ios') {
|
|
136
161
|
return KeyWordRNBridge.startKeywordDetection(
|
|
137
162
|
this.instanceId,
|
|
138
163
|
threshold,
|
|
164
|
+
speakerVerificationEnrollmentJsonOrPath,
|
|
139
165
|
setActive,
|
|
140
166
|
duckOthers,
|
|
141
167
|
mixWithOthers,
|
|
142
168
|
defaultToSpeaker
|
|
143
169
|
);
|
|
144
170
|
} else {
|
|
145
|
-
return KeyWordRNBridge.startKeywordDetection(
|
|
171
|
+
return KeyWordRNBridge.startKeywordDetection(
|
|
172
|
+
this.instanceId,
|
|
173
|
+
threshold,
|
|
174
|
+
speakerVerificationEnrollmentJsonOrPath
|
|
175
|
+
);
|
|
146
176
|
}
|
|
147
177
|
}
|
|
148
178
|
|
|
@@ -197,6 +227,14 @@ export const removeAllRNBridgeListeners = async () => {
|
|
|
197
227
|
keywordRNBridgeEmitter.removeAllListeners('onVADDetectionEvent'); // NEW
|
|
198
228
|
}
|
|
199
229
|
|
|
230
|
+
export const pauseDetection = async (instanceId, stopMic = false) => {
|
|
231
|
+
return KeyWordRNBridge.pauseDetection(instanceId, stopMic);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const unPauseDetection = async (instanceId) => {
|
|
235
|
+
return KeyWordRNBridge.unPauseDetection(instanceId);
|
|
236
|
+
};
|
|
237
|
+
|
|
200
238
|
export const createKeyWordRNBridgeInstance = async (instanceId, isSticky) => {
|
|
201
239
|
return await new KeyWordRNBridgeInstance(instanceId, isSticky);
|
|
202
240
|
};
|
package/wakewords/index.d.ts
CHANGED
|
@@ -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';
|