react-native-wakeword 1.1.56 → 1.1.58
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/KeyWordRNBridge.podspec +1 -1
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- 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 +764 -85
- package/android/src/main/java/com/davoice/speakeridrn/SpeakerIdRNBridge.java_not_used_yet +588 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +56 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +8970 -2462
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +112 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +8970 -2462
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +8970 -2462
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +133 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +34 -34
- package/ios/KeyWordRNBridge/KeyWordRNBridge.m +704 -3
- package/package.json +1 -1
- package/wakewords/SpeakerVerificationRNBridge.d.ts +49 -0
- package/wakewords/SpeakerVerificationRNBridge.js +294 -0
- package/wakewords/index.d.ts +18 -10
- package/wakewords/index.js +28 -0
- package/android/src/main/assets/coca_cola_model_28_05052025.dm +0 -0
- package/wakewords/index.d.ts.chat_idiot +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export class SpeakerVerificationRNBridgeInstance {
|
|
2
|
+
constructor(engineId: any);
|
|
3
|
+
engineId: any;
|
|
4
|
+
/**
|
|
5
|
+
* Create the native speaker verifier engine.
|
|
6
|
+
*
|
|
7
|
+
* modelPathOrName:
|
|
8
|
+
* - absolute path OR "speaker_model.dm" in the iOS app bundle
|
|
9
|
+
* - OR require('./assets/speaker_model.dm')
|
|
10
|
+
*
|
|
11
|
+
* enrollmentJsonPathOrName:
|
|
12
|
+
* - absolute path OR "enrollment.json" in the iOS app bundle
|
|
13
|
+
* - OR require('./assets/enrollment.json')
|
|
14
|
+
*
|
|
15
|
+
* options (optional):
|
|
16
|
+
* { decisionThreshold, frameSize, tailSeconds, maxTailSeconds, cmn, expectedLayoutBDT, logLevel }
|
|
17
|
+
*/
|
|
18
|
+
create(modelPathOrName: any, enrollmentJsonPathOrName: any, options?: {}): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Verify WAV by streaming in native.
|
|
21
|
+
*
|
|
22
|
+
* wavPathOrName:
|
|
23
|
+
* - absolute path OR "test.wav" in bundle
|
|
24
|
+
* - OR require('./assets/test.wav')
|
|
25
|
+
*
|
|
26
|
+
* resetState:
|
|
27
|
+
* - if true, clears internal streaming state before verification
|
|
28
|
+
*/
|
|
29
|
+
verifyWavStreaming(wavPathOrName: any, resetState?: boolean): Promise<any>;
|
|
30
|
+
destroy(): Promise<any>;
|
|
31
|
+
}
|
|
32
|
+
export function createSpeakerVerificationInstance(engineId: any): Promise<SpeakerVerificationRNBridgeInstance>;
|
|
33
|
+
export class SpeakerVerificationMicController {
|
|
34
|
+
constructor(controllerId: any);
|
|
35
|
+
controllerId: any;
|
|
36
|
+
create(configJson: any): Promise<any>;
|
|
37
|
+
beginOnboarding(enrollmentId: any, targetEmbeddingCount: any, reset?: boolean): Promise<any>;
|
|
38
|
+
getNextEmbeddingFromMic(): Promise<any>;
|
|
39
|
+
finalizeOnboardingNow(): Promise<any>;
|
|
40
|
+
setEnrollmentJson(enrollmentJson: any): Promise<any>;
|
|
41
|
+
startVerifyFromMic(resetState?: boolean): Promise<any>;
|
|
42
|
+
stop(): Promise<any>;
|
|
43
|
+
destroy(): Promise<any>;
|
|
44
|
+
}
|
|
45
|
+
export function createSpeakerVerificationMicController(controllerId: any): Promise<SpeakerVerificationMicController>;
|
|
46
|
+
export function onSpeakerVerificationOnboardingProgress(cb: any): () => void;
|
|
47
|
+
export function onSpeakerVerificationOnboardingDone(cb: any): () => void;
|
|
48
|
+
export function onSpeakerVerificationVerifyResult(cb: any): () => void;
|
|
49
|
+
export function onSpeakerVerificationError(cb: any): () => void;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// wakewords/SpeakerVerificationRNBridge.js
|
|
2
|
+
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
3
|
+
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
4
|
+
|
|
5
|
+
// Keep using the SAME native module (KeyWordRNBridge.m already exports these methods)
|
|
6
|
+
const { KeyWordRNBridge } = NativeModules;
|
|
7
|
+
const emitter = KeyWordRNBridge ? new NativeEventEmitter(KeyWordRNBridge) : null;
|
|
8
|
+
const VERBOSE = true;
|
|
9
|
+
const PFX = '[SVJS]';
|
|
10
|
+
const ts = () => new Date().toISOString();
|
|
11
|
+
function dbg(...args) { if (VERBOSE) console.log(ts(), PFX, ...args); }
|
|
12
|
+
function dbgErr(...args) { console.log(ts(), PFX, '❌', ...args); }
|
|
13
|
+
|
|
14
|
+
function stripFileScheme(uri) {
|
|
15
|
+
if (!uri) return uri;
|
|
16
|
+
return uri.startsWith('file://') ? uri.replace('file://', '') : uri;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Accepts:
|
|
20
|
+
// - string (absolute path OR "name.ext")
|
|
21
|
+
// - require('...') (number) -> resolved to uri/path
|
|
22
|
+
function normalizePathOrName(input) {
|
|
23
|
+
if (input == null) return input;
|
|
24
|
+
|
|
25
|
+
// require(...) returns a number in RN
|
|
26
|
+
if (typeof input === 'number') {
|
|
27
|
+
const src = resolveAssetSource(input);
|
|
28
|
+
// src.uri might be:
|
|
29
|
+
// - "file:///.../name.onnx" (iOS)
|
|
30
|
+
// - "asset:/name.onnx" or "assets:/..." (Android)
|
|
31
|
+
// We pass through; native iOS resolver handles bundle names too.
|
|
32
|
+
if (src?.uri) return stripFileScheme(src.uri);
|
|
33
|
+
return input;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof input === 'string') {
|
|
37
|
+
return stripFileScheme(input);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// if someone passes an object accidentally, just stringify it
|
|
41
|
+
return String(input);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function assertMethod(name) {
|
|
45
|
+
if (!KeyWordRNBridge?.[name]) {
|
|
46
|
+
throw new Error(`KeyWordRNBridge.${name} is not available (native not linked / iOS only?)`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class SpeakerVerificationRNBridgeInstance {
|
|
51
|
+
engineId;
|
|
52
|
+
|
|
53
|
+
constructor(engineId) {
|
|
54
|
+
this.engineId = engineId;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create the native speaker verifier engine.
|
|
59
|
+
*
|
|
60
|
+
* modelPathOrName:
|
|
61
|
+
* - absolute path OR "speaker_model.dm" in the iOS app bundle
|
|
62
|
+
* - OR require('./assets/speaker_model.dm')
|
|
63
|
+
*
|
|
64
|
+
* enrollmentJsonPathOrName:
|
|
65
|
+
* - absolute path OR "enrollment.json" in the iOS app bundle
|
|
66
|
+
* - OR require('./assets/enrollment.json')
|
|
67
|
+
*
|
|
68
|
+
* options (optional):
|
|
69
|
+
* { decisionThreshold, frameSize, tailSeconds, maxTailSeconds, cmn, expectedLayoutBDT, logLevel }
|
|
70
|
+
*/
|
|
71
|
+
async create(modelPathOrName, enrollmentJsonPathOrName, options = {}) {
|
|
72
|
+
|
|
73
|
+
assertMethod('createSpeakerVerifier');
|
|
74
|
+
|
|
75
|
+
const modelArg = normalizePathOrName(modelPathOrName);
|
|
76
|
+
const jsonArg = normalizePathOrName(enrollmentJsonPathOrName);
|
|
77
|
+
|
|
78
|
+
dbg('createSpeakerVerifier args:',
|
|
79
|
+
{ engineId: this.engineId, modelArg, jsonArg, options });
|
|
80
|
+
|
|
81
|
+
return await KeyWordRNBridge.createSpeakerVerifier(
|
|
82
|
+
this.engineId,
|
|
83
|
+
modelArg,
|
|
84
|
+
jsonArg,
|
|
85
|
+
options || {}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Verify WAV by streaming in native.
|
|
91
|
+
*
|
|
92
|
+
* wavPathOrName:
|
|
93
|
+
* - absolute path OR "test.wav" in bundle
|
|
94
|
+
* - OR require('./assets/test.wav')
|
|
95
|
+
*
|
|
96
|
+
* resetState:
|
|
97
|
+
* - if true, clears internal streaming state before verification
|
|
98
|
+
*/
|
|
99
|
+
async verifyWavStreaming(wavPathOrName, resetState = true) {
|
|
100
|
+
|
|
101
|
+
assertMethod('verifySpeakerWavStreaming');
|
|
102
|
+
|
|
103
|
+
const wavArg = normalizePathOrName(wavPathOrName);
|
|
104
|
+
dbg('verifySpeakerWavStreaming args:', { engineId: this.engineId, wavArg, resetState: !!resetState });
|
|
105
|
+
|
|
106
|
+
return await KeyWordRNBridge.verifySpeakerWavStreaming(
|
|
107
|
+
this.engineId,
|
|
108
|
+
wavArg,
|
|
109
|
+
!!resetState
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async destroy() {
|
|
114
|
+
assertMethod('destroySpeakerVerifier');
|
|
115
|
+
return await KeyWordRNBridge.destroySpeakerVerifier(this.engineId);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Convenience creator (parity with wakeword side)
|
|
120
|
+
export const createSpeakerVerificationInstance = async (engineId) => {
|
|
121
|
+
return new SpeakerVerificationRNBridgeInstance(engineId);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// ============================================================
|
|
125
|
+
// MARK: - Speaker Verification Mic Controller (Swift) - RN APIs
|
|
126
|
+
// ============================================================
|
|
127
|
+
export class SpeakerVerificationMicController {
|
|
128
|
+
controllerId;
|
|
129
|
+
|
|
130
|
+
constructor(controllerId) {
|
|
131
|
+
this.controllerId = controllerId;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async create(configJson) {
|
|
135
|
+
assertMethod('createSpeakerVerificationMicController');
|
|
136
|
+
// IMPORTANT: must pass a REAL JSON string, not "[object Object]"
|
|
137
|
+
const jsonStr = (typeof configJson === 'string')
|
|
138
|
+
? configJson
|
|
139
|
+
: JSON.stringify(configJson ?? {});
|
|
140
|
+
dbg('createSpeakerVerificationMicController args:',
|
|
141
|
+
{ controllerId: this.controllerId, jsonStrLen: jsonStr.length, jsonStr });
|
|
142
|
+
return await KeyWordRNBridge.createSpeakerVerificationMicController(this.controllerId, jsonStr);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async beginOnboarding(enrollmentId, targetEmbeddingCount, reset = true) {
|
|
146
|
+
|
|
147
|
+
assertMethod('svBeginOnboarding');
|
|
148
|
+
dbg('svBeginOnboarding args:', { controllerId: this.controllerId, enrollmentId, targetEmbeddingCount, reset: !!reset });
|
|
149
|
+
|
|
150
|
+
return await KeyWordRNBridge.svBeginOnboarding(
|
|
151
|
+
this.controllerId,
|
|
152
|
+
String(enrollmentId ?? ''),
|
|
153
|
+
Number(targetEmbeddingCount ?? 0),
|
|
154
|
+
!!reset
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getNextEmbeddingFromMic() {
|
|
159
|
+
|
|
160
|
+
assertMethod('svGetNextEmbeddingFromMic');
|
|
161
|
+
dbg('svGetNextEmbeddingFromMic args:', { controllerId: this.controllerId });
|
|
162
|
+
|
|
163
|
+
return await KeyWordRNBridge.svGetNextEmbeddingFromMic(this.controllerId);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async finalizeOnboardingNow() {
|
|
167
|
+
|
|
168
|
+
assertMethod('svFinalizeOnboardingNow');
|
|
169
|
+
dbg('svFinalizeOnboardingNow args:', { controllerId: this.controllerId });
|
|
170
|
+
|
|
171
|
+
return await KeyWordRNBridge.svFinalizeOnboardingNow(this.controllerId);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async setEnrollmentJson(enrollmentJson) {
|
|
175
|
+
|
|
176
|
+
assertMethod('svSetEnrollmentJson');
|
|
177
|
+
dbg('svSetEnrollmentJson args:', { controllerId: this.controllerId, len: String(enrollmentJson ?? '').length });
|
|
178
|
+
|
|
179
|
+
// if caller passes object, stringify it (native expects JSON string)
|
|
180
|
+
const s =
|
|
181
|
+
typeof enrollmentJson === 'string'
|
|
182
|
+
? enrollmentJson
|
|
183
|
+
: JSON.stringify(enrollmentJson ?? {});
|
|
184
|
+
|
|
185
|
+
return await KeyWordRNBridge.svSetEnrollmentJson(
|
|
186
|
+
this.controllerId,
|
|
187
|
+
s
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async startVerifyFromMic(resetState = true) {
|
|
192
|
+
|
|
193
|
+
assertMethod('svStartVerifyFromMic');
|
|
194
|
+
dbg('svStartVerifyFromMic args:', { controllerId: this.controllerId, resetState: !!resetState });
|
|
195
|
+
|
|
196
|
+
return await KeyWordRNBridge.svStartVerifyFromMic(
|
|
197
|
+
this.controllerId,
|
|
198
|
+
!!resetState
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async stop() {
|
|
203
|
+
assertMethod('svStopMic');
|
|
204
|
+
return await KeyWordRNBridge.svStopMic(this.controllerId);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async destroy() {
|
|
208
|
+
assertMethod('destroySpeakerVerificationMicController');
|
|
209
|
+
return await KeyWordRNBridge.destroySpeakerVerificationMicController(this.controllerId);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export const createSpeakerVerificationMicController = async (controllerId) => {
|
|
214
|
+
return new SpeakerVerificationMicController(controllerId);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
async function verifyFromMicWithEnrollment(enrollmentJson, setUiMessage) {
|
|
218
|
+
|
|
219
|
+
const micConfig = {
|
|
220
|
+
modelPath: 'speaker_model.dm',
|
|
221
|
+
options: {
|
|
222
|
+
decisionThreshold: 0.35,
|
|
223
|
+
tailSeconds: 2.0,
|
|
224
|
+
frameSize: 1280,
|
|
225
|
+
maxTailSeconds: 3.0,
|
|
226
|
+
cmn: true,
|
|
227
|
+
expectedLayoutBDT: false,
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const ctrl = await createSpeakerVerificationMicController('svMicVerify1');
|
|
232
|
+
await ctrl.create(JSON.stringify(micConfig));
|
|
233
|
+
try {
|
|
234
|
+
// IMPORTANT: set enrollment BEFORE starting verify
|
|
235
|
+
await ctrl.setEnrollmentJson(enrollmentJson);
|
|
236
|
+
|
|
237
|
+
const waitVerify = (timeoutMs = 60_000) =>
|
|
238
|
+
new Promise<any>((resolve, reject) => {
|
|
239
|
+
const offR = onSpeakerVerificationVerifyResult((e) => {
|
|
240
|
+
if (e?.controllerId !== 'svMicVerify1') return;
|
|
241
|
+
offR?.();
|
|
242
|
+
offE?.();
|
|
243
|
+
resolve(e);
|
|
244
|
+
});
|
|
245
|
+
const offE = onSpeakerVerificationError((e) => {
|
|
246
|
+
if (e?.controllerId !== 'svMicVerify1') return;
|
|
247
|
+
offR?.();
|
|
248
|
+
offE?.();
|
|
249
|
+
reject(new Error(`[SVJS] verify error: ${JSON.stringify(e)}`));
|
|
250
|
+
});
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
offR?.();
|
|
253
|
+
offE?.();
|
|
254
|
+
reject(new Error('NO_SPEECH_TIMEOUT'));
|
|
255
|
+
}, timeoutMs);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// start one verify pass (native should emit onSpeakerVerificationVerifyResult)
|
|
259
|
+
setUiMessage?.('🎙️ Mic verify: please speak (up to 60s)...');
|
|
260
|
+
await ctrl.startVerifyFromMic(true);
|
|
261
|
+
|
|
262
|
+
const res = await waitVerify(60_000);
|
|
263
|
+
console.log('[SVJS] mic verify result event:', res);
|
|
264
|
+
setUiMessage?.(`✅ Mic verify done → score=${res?.bestScore ?? res?.score ?? 'n/a'}`);
|
|
265
|
+
return res;
|
|
266
|
+
} finally {
|
|
267
|
+
await ctrl.stop().catch(() => {});
|
|
268
|
+
await ctrl.destroy().catch(() => {});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ============================================================
|
|
273
|
+
// MARK: - Event helpers
|
|
274
|
+
// ============================================================
|
|
275
|
+
|
|
276
|
+
function onEvent(eventName, cb) {
|
|
277
|
+
if (!emitter) {
|
|
278
|
+
throw new Error('NativeEventEmitter unavailable: KeyWordRNBridge is not linked.');
|
|
279
|
+
}
|
|
280
|
+
const sub = emitter.addListener(eventName, cb);
|
|
281
|
+
return () => sub.remove();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export const onSpeakerVerificationOnboardingProgress = (cb) =>
|
|
285
|
+
onEvent('onSpeakerVerificationOnboardingProgress', cb);
|
|
286
|
+
|
|
287
|
+
export const onSpeakerVerificationOnboardingDone = (cb) =>
|
|
288
|
+
onEvent('onSpeakerVerificationOnboardingDone', cb);
|
|
289
|
+
|
|
290
|
+
export const onSpeakerVerificationVerifyResult = (cb) =>
|
|
291
|
+
onEvent('onSpeakerVerificationVerifyResult', cb);
|
|
292
|
+
|
|
293
|
+
export const onSpeakerVerificationError = (cb) =>
|
|
294
|
+
onEvent('onSpeakerVerificationError', cb);
|
package/wakewords/index.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
export default useModel;
|
|
2
|
-
import { enableDucking } from
|
|
3
|
-
import { disableDucking } from
|
|
4
|
-
import { initAudioSessAndDuckManage } from
|
|
5
|
-
import { restartListeningAfterDucking } from
|
|
6
|
-
import { removeAllRNBridgeListeners } from
|
|
7
|
-
import { createKeyWordRNBridgeInstance } from
|
|
8
|
-
import { KeyWordRNBridgeInstance } from
|
|
9
|
-
import { setWakewordAudioRoutingConfig } from
|
|
10
|
-
import
|
|
11
|
-
|
|
2
|
+
import { enableDucking } from './KeyWordRNBridge';
|
|
3
|
+
import { disableDucking } from './KeyWordRNBridge';
|
|
4
|
+
import { initAudioSessAndDuckManage } from './KeyWordRNBridge';
|
|
5
|
+
import { restartListeningAfterDucking } from './KeyWordRNBridge';
|
|
6
|
+
import { removeAllRNBridgeListeners } from './KeyWordRNBridge';
|
|
7
|
+
import { createKeyWordRNBridgeInstance } from './KeyWordRNBridge';
|
|
8
|
+
import { KeyWordRNBridgeInstance } from './KeyWordRNBridge';
|
|
9
|
+
import { setWakewordAudioRoutingConfig } from './KeyWordRNBridge';
|
|
10
|
+
import { createSpeakerVerificationInstance } from './SpeakerVerificationRNBridge';
|
|
11
|
+
import { SpeakerVerificationRNBridgeInstance } from './SpeakerVerificationRNBridge';
|
|
12
|
+
import { createSpeakerVerificationMicController } from './SpeakerVerificationRNBridge';
|
|
13
|
+
import { SpeakerVerificationMicController } from './SpeakerVerificationRNBridge';
|
|
14
|
+
import { onSpeakerVerificationOnboardingProgress } from './SpeakerVerificationRNBridge';
|
|
15
|
+
import { onSpeakerVerificationOnboardingDone } from './SpeakerVerificationRNBridge';
|
|
16
|
+
import { onSpeakerVerificationVerifyResult } from './SpeakerVerificationRNBridge';
|
|
17
|
+
import { onSpeakerVerificationError } from './SpeakerVerificationRNBridge';
|
|
18
|
+
import useModel from './useModel';
|
|
19
|
+
export { enableDucking, disableDucking, initAudioSessAndDuckManage, restartListeningAfterDucking, removeAllRNBridgeListeners, createKeyWordRNBridgeInstance, KeyWordRNBridgeInstance, setWakewordAudioRoutingConfig, createSpeakerVerificationInstance, SpeakerVerificationRNBridgeInstance, createSpeakerVerificationMicController, SpeakerVerificationMicController, onSpeakerVerificationOnboardingProgress, onSpeakerVerificationOnboardingDone, onSpeakerVerificationVerifyResult, onSpeakerVerificationError, useModel };
|
|
12
20
|
|
|
13
21
|
// Re-export routing types for consumers:
|
|
14
22
|
export type { AudioRoutingConfig, RouteConfigEntry } from './audioRoutingConfig';
|
package/wakewords/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// wakewords/index.js
|
|
2
|
+
|
|
1
3
|
import useModel from './useModel';
|
|
2
4
|
import {
|
|
3
5
|
createKeyWordRNBridgeInstance,
|
|
@@ -10,6 +12,18 @@ import {
|
|
|
10
12
|
setWakewordAudioRoutingConfig, // ← NEW
|
|
11
13
|
} from './KeyWordRNBridge';
|
|
12
14
|
|
|
15
|
+
// ✅ NEW speaker verification bridge exports
|
|
16
|
+
import {
|
|
17
|
+
createSpeakerVerificationInstance,
|
|
18
|
+
SpeakerVerificationRNBridgeInstance,
|
|
19
|
+
createSpeakerVerificationMicController,
|
|
20
|
+
SpeakerVerificationMicController,
|
|
21
|
+
onSpeakerVerificationOnboardingProgress,
|
|
22
|
+
onSpeakerVerificationOnboardingDone,
|
|
23
|
+
onSpeakerVerificationVerifyResult,
|
|
24
|
+
onSpeakerVerificationError,
|
|
25
|
+
} from './SpeakerVerificationRNBridge';
|
|
26
|
+
|
|
13
27
|
export { enableDucking }
|
|
14
28
|
export { disableDucking }
|
|
15
29
|
export { initAudioSessAndDuckManage }
|
|
@@ -18,5 +32,19 @@ export { removeAllRNBridgeListeners }
|
|
|
18
32
|
export { createKeyWordRNBridgeInstance }
|
|
19
33
|
export { KeyWordRNBridgeInstance }
|
|
20
34
|
export { setWakewordAudioRoutingConfig } // ← NEW
|
|
35
|
+
|
|
36
|
+
export { createSpeakerVerificationInstance }; // ✅ NEW
|
|
37
|
+
export { SpeakerVerificationRNBridgeInstance }; // ✅ NEW
|
|
38
|
+
|
|
39
|
+
// ✅ NEW speaker verification mic controller exports
|
|
40
|
+
export { createSpeakerVerificationMicController };
|
|
41
|
+
export { SpeakerVerificationMicController };
|
|
42
|
+
export {
|
|
43
|
+
onSpeakerVerificationOnboardingProgress,
|
|
44
|
+
onSpeakerVerificationOnboardingDone,
|
|
45
|
+
onSpeakerVerificationVerifyResult,
|
|
46
|
+
onSpeakerVerificationError,
|
|
47
|
+
};
|
|
48
|
+
|
|
21
49
|
export { useModel }; // Export only useModel
|
|
22
50
|
export default useModel; // Allow default import
|
|
Binary file
|