react-native-wakeword 1.1.21 → 1.1.23

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 (31) 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/android/src/main/assets/coca_cola_model_28_05052025.onnx +0 -0
  5. package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +45 -3
  6. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +4 -1
  7. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
  8. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  9. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +346 -123
  10. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +5 -3
  11. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  12. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +5 -3
  13. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +8 -2
  14. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
  15. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  16. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +346 -123
  17. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +5 -3
  18. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +5 -3
  20. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +346 -123
  21. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +5 -3
  22. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +5 -3
  24. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeDirectory +0 -0
  25. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeRequirements-1 +0 -0
  26. package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +34 -34
  27. package/ios/KeyWordRNBridge/KeyWordRNBridge.mm +64 -0
  28. package/ios/KeyWordRNBridge/models/coca_cola_model_28_05052025.onnx +0 -0
  29. package/package.json +1 -1
  30. package/wakewords/KeyWordRNBridge.d.ts +2 -0
  31. package/wakewords/KeyWordRNBridge.js +28 -1
@@ -1,6 +1,6 @@
1
1
  // swift-interface-format-version: 1.0
2
2
  // swift-compiler-version: Apple Swift version 6.1.2 effective-5.10 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
3
- // swift-module-flags: -target x86_64-apple-ios13-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-experimental-feature DebugDescriptionMacro -enable-bare-slash-regex -module-name KeyWordDetection
3
+ // swift-module-flags: -target x86_64-apple-ios13.5-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-experimental-feature DebugDescriptionMacro -enable-bare-slash-regex -module-name KeyWordDetection
4
4
  // swift-module-flags-ignorable: -no-verify-emitted-module-interface -interface-compiler-version 6.1.2
5
5
  import AVFAudio
6
6
  import AVFoundation
@@ -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, setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true)
53
+ public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32)
54
54
  public func stop() throws
55
55
  @objc deinit
56
56
  }
@@ -106,8 +106,10 @@ public class AVAudioWrapper {
106
106
  @objc weak public var delegate: (any KeyWordDetection.KeywordDetectionRNDelegate)?
107
107
  public var eventSink: (([Swift.String : Any]) -> Swift.Void)?
108
108
  @objc convenience public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
109
- @objc public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int, cancelEcho: Swift.Bool = false) throws
109
+ @objc convenience public init(modelPaths: [Swift.String], thresholds: [Foundation.NSNumber], bufferCnts: [Foundation.NSNumber], msBetweenCallback: [Foundation.NSNumber]) throws
110
+ @objc public init(modelPaths: [Swift.String], thresholds: [Swift.Float], bufferCnts: [Swift.Int], msBetweenCallback: [Swift.Int64], cancelEcho: Swift.Bool = false) throws
110
111
  @objc public func replaceKeywordDetectionModel(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
112
+ @objc public func replaceKeywordDetectionModels(modelPaths: [Swift.String], thresholds: [Swift.Float], bufferCnts: [Swift.Int], msBetweenCallback: [Swift.Int64]) throws
111
113
  @objc public func getKeywordDetectionModel() -> Swift.String
112
114
  @objc public func getRecordingWav() -> Swift.String
113
115
  @objc public func setKeywordDetectionLicense(licenseKey: Swift.String) -> Swift.Bool
@@ -1,6 +1,6 @@
1
1
  // swift-interface-format-version: 1.0
2
2
  // swift-compiler-version: Apple Swift version 6.1.2 effective-5.10 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
3
- // swift-module-flags: -target x86_64-apple-ios13-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-experimental-feature DebugDescriptionMacro -enable-bare-slash-regex -module-name KeyWordDetection
3
+ // swift-module-flags: -target x86_64-apple-ios13.5-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-experimental-feature DebugDescriptionMacro -enable-bare-slash-regex -module-name KeyWordDetection
4
4
  // swift-module-flags-ignorable: -no-verify-emitted-module-interface -interface-compiler-version 6.1.2
5
5
  import AVFAudio
6
6
  import AVFoundation
@@ -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, setActive: Swift.Bool = true, duckOthers: Swift.Bool = false, mixWithOthers: Swift.Bool = true, defaultToSpeaker: Swift.Bool = true)
53
+ public func start(frameLength: Swift.UInt32, sampleRate: Swift.UInt32)
54
54
  public func stop() throws
55
55
  @objc deinit
56
56
  }
@@ -106,8 +106,10 @@ public class AVAudioWrapper {
106
106
  @objc weak public var delegate: (any KeyWordDetection.KeywordDetectionRNDelegate)?
107
107
  public var eventSink: (([Swift.String : Any]) -> Swift.Void)?
108
108
  @objc convenience public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
109
- @objc public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int, cancelEcho: Swift.Bool = false) throws
109
+ @objc convenience public init(modelPaths: [Swift.String], thresholds: [Foundation.NSNumber], bufferCnts: [Foundation.NSNumber], msBetweenCallback: [Foundation.NSNumber]) throws
110
+ @objc public init(modelPaths: [Swift.String], thresholds: [Swift.Float], bufferCnts: [Swift.Int], msBetweenCallback: [Swift.Int64], cancelEcho: Swift.Bool = false) throws
110
111
  @objc public func replaceKeywordDetectionModel(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
112
+ @objc public func replaceKeywordDetectionModels(modelPaths: [Swift.String], thresholds: [Swift.Float], bufferCnts: [Swift.Int], msBetweenCallback: [Swift.Int64]) throws
111
113
  @objc public func getKeywordDetectionModel() -> Swift.String
112
114
  @objc public func getRecordingWav() -> Swift.String
113
115
  @objc public func setKeywordDetectionLicense(licenseKey: Swift.String) -> Swift.Bool
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Headers/KeyWordDetection-Swift.h</key>
8
8
  <data>
9
- dyetOGzCUSbh+NBwZekrAEh/M2I=
9
+ 2LuxvPIzEv/mCjRCRJQR1iQMgJI=
10
10
  </data>
11
11
  <key>Headers/KeyWordDetection.h</key>
12
12
  <data>
@@ -14,47 +14,47 @@
14
14
  </data>
15
15
  <key>Info.plist</key>
16
16
  <data>
17
- L3dRigWzWuR7k+paH+0Og0o3MOs=
17
+ sSoVDG0TLK7+xwNThNe8Ny1Omu0=
18
18
  </data>
19
19
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
21
- EmQ2teQfgTapW0ygjSz5H19nzA4=
21
+ EY70Vi5l2+TyeuF6kR7sQrG6Dts=
22
22
  </data>
23
23
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
24
24
  <data>
25
- PsxoWcpEnXEKezDqzkFUKRqWfdc=
25
+ Oin84KT6uz+Dz5zyaKdFqrTHEuY=
26
26
  </data>
27
27
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
28
28
  <data>
29
- KGK1XtiC7UVRxWPQ+2rX5PFCQF4=
29
+ pZsSKXuNOvF3YTKH6zkbn+hGvYg=
30
30
  </data>
31
31
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
32
32
  <data>
33
- PsxoWcpEnXEKezDqzkFUKRqWfdc=
33
+ Oin84KT6uz+Dz5zyaKdFqrTHEuY=
34
34
  </data>
35
35
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
36
36
  <data>
37
- 2PfyfBtwCx2y/M0d3AdAb6Bajx8=
37
+ FP/AMZo0XFEA5PvaPwZLL/jWjKM=
38
38
  </data>
39
39
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
40
40
  <data>
41
- EmQ2teQfgTapW0ygjSz5H19nzA4=
41
+ EY70Vi5l2+TyeuF6kR7sQrG6Dts=
42
42
  </data>
43
43
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
44
44
  <data>
45
- 85dlU4jiFlZGxYHinqPNRbxi9y4=
45
+ thI3UPX8hf9jbWYqnJfUg5vy1p8=
46
46
  </data>
47
47
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
48
48
  <data>
49
- WngUNmZdW9HV0L6r4qQDQQzsfjQ=
49
+ obKcLl48LCRITPrTt9lIXud6M8A=
50
50
  </data>
51
51
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
52
52
  <data>
53
- 85dlU4jiFlZGxYHinqPNRbxi9y4=
53
+ thI3UPX8hf9jbWYqnJfUg5vy1p8=
54
54
  </data>
55
55
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
56
56
  <data>
57
- 9iAcs52iycV3Wq6yDzA+lEAN8+w=
57
+ BmYqWV87vAR1rAhnDXOOBQrZQUg=
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
- dyetOGzCUSbh+NBwZekrAEh/M2I=
70
+ 2LuxvPIzEv/mCjRCRJQR1iQMgJI=
71
71
  </data>
72
72
  <key>hash2</key>
73
73
  <data>
74
- +F1Hic5Pbd+gQo20D6o/zNzxjYHl/Imq91JAJVyPWOA=
74
+ PZysvYbQcZjqeW7WSVHAUa+KpiZFNPYwOWtz3z/WqLM=
75
75
  </data>
76
76
  </dict>
77
77
  <key>Headers/KeyWordDetection.h</key>
@@ -89,110 +89,110 @@
89
89
  <dict>
90
90
  <key>hash</key>
91
91
  <data>
92
- EmQ2teQfgTapW0ygjSz5H19nzA4=
92
+ EY70Vi5l2+TyeuF6kR7sQrG6Dts=
93
93
  </data>
94
94
  <key>hash2</key>
95
95
  <data>
96
- HzEZNf0/dMKsp+uNEzEMxlpOp/rqZ0ZZ3i5HNzBmRDc=
96
+ YH/r0C6uDH33pNh/+cNl+W+13kRqOpgDD0FzRWgglIo=
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
- PsxoWcpEnXEKezDqzkFUKRqWfdc=
103
+ Oin84KT6uz+Dz5zyaKdFqrTHEuY=
104
104
  </data>
105
105
  <key>hash2</key>
106
106
  <data>
107
- xyK1ZhF6lr6CgOUc0ePOu9ZP6Gng0V9PbUeR97+wfYQ=
107
+ vI9ROONuqIho451juaviLqAEtfyvhX6To4DxdUhfN8g=
108
108
  </data>
109
109
  </dict>
110
110
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
111
111
  <dict>
112
112
  <key>hash</key>
113
113
  <data>
114
- KGK1XtiC7UVRxWPQ+2rX5PFCQF4=
114
+ pZsSKXuNOvF3YTKH6zkbn+hGvYg=
115
115
  </data>
116
116
  <key>hash2</key>
117
117
  <data>
118
- PLmoMUimTD/1NSL4/SCA3iok0JSOmDdH4QVhORvOskg=
118
+ i7XuxhozqyxYFrqDfphp4ea79bLoHwvKXvQEGxnZ5K0=
119
119
  </data>
120
120
  </dict>
121
121
  <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
122
122
  <dict>
123
123
  <key>hash</key>
124
124
  <data>
125
- PsxoWcpEnXEKezDqzkFUKRqWfdc=
125
+ Oin84KT6uz+Dz5zyaKdFqrTHEuY=
126
126
  </data>
127
127
  <key>hash2</key>
128
128
  <data>
129
- xyK1ZhF6lr6CgOUc0ePOu9ZP6Gng0V9PbUeR97+wfYQ=
129
+ vI9ROONuqIho451juaviLqAEtfyvhX6To4DxdUhfN8g=
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
- 2PfyfBtwCx2y/M0d3AdAb6Bajx8=
136
+ FP/AMZo0XFEA5PvaPwZLL/jWjKM=
137
137
  </data>
138
138
  <key>hash2</key>
139
139
  <data>
140
- c5ZB1moyUYX3/isjyrWpOhPp0S5wEJWosFDKA+//fsk=
140
+ 8+7AezYoEvzbyhpez1sqslZrpycfxyxTeNUQDhvFIds=
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
- EmQ2teQfgTapW0ygjSz5H19nzA4=
147
+ EY70Vi5l2+TyeuF6kR7sQrG6Dts=
148
148
  </data>
149
149
  <key>hash2</key>
150
150
  <data>
151
- HzEZNf0/dMKsp+uNEzEMxlpOp/rqZ0ZZ3i5HNzBmRDc=
151
+ YH/r0C6uDH33pNh/+cNl+W+13kRqOpgDD0FzRWgglIo=
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
- 85dlU4jiFlZGxYHinqPNRbxi9y4=
158
+ thI3UPX8hf9jbWYqnJfUg5vy1p8=
159
159
  </data>
160
160
  <key>hash2</key>
161
161
  <data>
162
- PF1BM66gtI41d2cmefWYUC02lqixlffshm1a20r1JjA=
162
+ IWwaGRP2KyO5wCQ2MmsysDr6LR1qu255Oktn7QySVW4=
163
163
  </data>
164
164
  </dict>
165
165
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
166
166
  <dict>
167
167
  <key>hash</key>
168
168
  <data>
169
- WngUNmZdW9HV0L6r4qQDQQzsfjQ=
169
+ obKcLl48LCRITPrTt9lIXud6M8A=
170
170
  </data>
171
171
  <key>hash2</key>
172
172
  <data>
173
- yRBEg5nBM7imjU9MJzbX9QyYxgrpIUKyaSgZmncDkWQ=
173
+ 2N6P/hWCk5d8/u4tj1vNes79Dndx9XCG11jarZXMBvw=
174
174
  </data>
175
175
  </dict>
176
176
  <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
177
177
  <dict>
178
178
  <key>hash</key>
179
179
  <data>
180
- 85dlU4jiFlZGxYHinqPNRbxi9y4=
180
+ thI3UPX8hf9jbWYqnJfUg5vy1p8=
181
181
  </data>
182
182
  <key>hash2</key>
183
183
  <data>
184
- PF1BM66gtI41d2cmefWYUC02lqixlffshm1a20r1JjA=
184
+ IWwaGRP2KyO5wCQ2MmsysDr6LR1qu255Oktn7QySVW4=
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
- 9iAcs52iycV3Wq6yDzA+lEAN8+w=
191
+ BmYqWV87vAR1rAhnDXOOBQrZQUg=
192
192
  </data>
193
193
  <key>hash2</key>
194
194
  <data>
195
- V81DQs9E6s1LrCOG8f1xWPmVFX3RL60w5wuu/NBxax0=
195
+ UbvvT8lkWfDmihTxmj/CAQDsQX2/qle8wjHBoniC8Zc=
196
196
  </data>
197
197
  </dict>
198
198
  <key>Modules/module.modulemap</key>
@@ -21,6 +21,14 @@
21
21
  bridge:(KeyWordRNBridge *)bridge
22
22
  error:(NSError **)error;
23
23
 
24
+ - (instancetype)initWithInstanceId:(NSString *)instanceId
25
+ modelNames:(NSArray<NSString *> *)modelNames
26
+ thresholds:(NSArray<NSNumber *> *)thresholds
27
+ bufferCnts:(NSArray<NSNumber *> *)bufferCnts
28
+ msBetweenCallback:(NSArray<NSNumber *> *)msBetweenCallback
29
+ bridge:(KeyWordRNBridge *)bridge
30
+ error:(NSError **)error;
31
+
24
32
  @end
25
33
 
26
34
  @implementation KeyWordsDetectionWrapper
@@ -44,6 +52,33 @@
44
52
  return self;
45
53
  }
46
54
 
55
+ - (instancetype)initWithInstanceId:(NSString *)instanceId
56
+ modelNames:(NSArray<NSString *> *)modelNames
57
+ thresholds:(NSArray<NSNumber *> *)thresholds
58
+ bufferCnts:(NSArray<NSNumber *> *)bufferCnts
59
+ msBetweenCallback:(NSArray<NSNumber *> *)msBetweenCallback
60
+ bridge:(KeyWordRNBridge *)bridge
61
+ error:(NSError **)error {
62
+ if (self = [super init]) {
63
+ _instanceId = instanceId;
64
+ _bridge = bridge;
65
+
66
+ NSMutableArray<NSNumber *> *floatThresholds = [NSMutableArray array];
67
+ for (NSNumber *num in thresholds) {
68
+ [floatThresholds addObject:@(num.floatValue)];
69
+ }
70
+
71
+ _keyWordsDetection = [[KeyWordsDetection alloc] initWithModelPaths:modelNames
72
+ thresholds:floatThresholds
73
+ bufferCnts:bufferCnts
74
+ msBetweenCallback:msBetweenCallback
75
+ error:error];
76
+ if (*error) return nil;
77
+ _keyWordsDetection.delegate = self;
78
+ }
79
+ return self;
80
+ }
81
+
47
82
  // Implement the delegate method
48
83
  - (void)KeywordDetectionDidDetectEvent:(NSDictionary *)eventInfo {
49
84
  NSMutableDictionary *mutableEventInfo = [eventInfo mutableCopy];
@@ -79,6 +114,35 @@ RCT_EXPORT_MODULE();
79
114
  return @[@"onKeywordDetectionEvent"];
80
115
  }
81
116
 
117
+ RCT_EXPORT_METHOD(createInstanceMulti:(NSString *)instanceId
118
+ modelPaths:(NSArray<NSString *> *)modelPaths
119
+ thresholds:(NSArray<NSNumber *> *)thresholds
120
+ bufferCnts:(NSArray<NSNumber *> *)bufferCnts
121
+ msBetweenCallback:(NSArray<NSNumber *> *)msBetweenCallback
122
+ resolver:(RCTPromiseResolveBlock)resolve
123
+ rejecter:(RCTPromiseRejectBlock)reject) {
124
+ if (self.instances[instanceId]) {
125
+ reject(@"InstanceExists", [NSString stringWithFormat:@"Instance already exists with ID: %@", instanceId], nil);
126
+ return;
127
+ }
128
+
129
+ NSError *error = nil;
130
+ KeyWordsDetectionWrapper *wrapper = [[KeyWordsDetectionWrapper alloc]
131
+ initWithInstanceId:instanceId
132
+ modelNames:modelPaths
133
+ thresholds:thresholds
134
+ bufferCnts:bufferCnts
135
+ msBetweenCallback:msBetweenCallback
136
+ bridge:self
137
+ error:&error];
138
+ if (error) {
139
+ reject(@"CreateError", [NSString stringWithFormat:@"Failed to create multi-model instance: %@", error.localizedDescription], nil);
140
+ } else {
141
+ self.instances[instanceId] = wrapper;
142
+ resolve([NSString stringWithFormat:@"Multi-model instance created with ID: %@", instanceId]);
143
+ }
144
+ }
145
+
82
146
  RCT_EXPORT_METHOD(createInstance:(NSString *)instanceId modelName:(NSString *)modelName threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
83
147
  {
84
148
  if (self.instances[instanceId]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",
@@ -4,11 +4,13 @@ export class KeyWordRNBridgeInstance {
4
4
  listeners: any[];
5
5
  isFirstInstance: boolean;
6
6
  isSticky: any;
7
+ createInstanceMulti(modelNames: any, thresholds: any, bufferCnts: any, msBetweenCallbacks: any): Promise<any>;
7
8
  createInstance(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
8
9
  setKeywordDetectionLicense(license: any): Promise<any>;
9
10
  replaceKeywordDetectionModel(modelName: any, threshold: any, bufferCnt: any): Promise<any>;
10
11
  setKeywordLicense(license: any): Promise<any>;
11
12
  startKeywordDetection(threshold: any, setActive?: boolean, duckOthers?: boolean, mixWithOthers?: boolean, defaultToSpeaker?: boolean): Promise<any>;
13
+ getRecordingWav(): Promise<any>;
12
14
  stopKeywordDetection(): Promise<any>;
13
15
  destroyInstance(): Promise<any>;
14
16
  onKeywordDetectionEvent(callback: any): import("react-native").EmitterSubscription;
@@ -20,6 +20,23 @@ export class KeyWordRNBridgeInstance {
20
20
  this.isSticky = isSticky;
21
21
  }
22
22
 
23
+ async createInstanceMulti(modelNames, thresholds, bufferCnts, msBetweenCallbacks) {
24
+ const instance = await KeyWordRNBridge.createInstanceMulti(
25
+ this.instanceId,
26
+ modelNames,
27
+ thresholds,
28
+ bufferCnts,
29
+ msBetweenCallbacks
30
+ );
31
+
32
+ if (instance && this.isFirstInstance) {
33
+ this.isFirstInstance = false;
34
+ await KeyWordRNBridge.startForegroundService(this.instanceId);
35
+ }
36
+
37
+ return instance;
38
+ }
39
+
23
40
  async createInstance(modelName, threshold, bufferCnt) {
24
41
  instance = await KeyWordRNBridge.createInstance(
25
42
  this.instanceId,
@@ -72,6 +89,10 @@ export class KeyWordRNBridgeInstance {
72
89
  }
73
90
  }
74
91
 
92
+ async getRecordingWav() {
93
+ return await KeyWordRNBridge.getRecordingWav(this.instanceId);
94
+ }
95
+
75
96
  async stopKeywordDetection() {
76
97
  return KeyWordRNBridge.stopKeywordDetection(this.instanceId);
77
98
  }
@@ -83,7 +104,13 @@ export class KeyWordRNBridgeInstance {
83
104
  onKeywordDetectionEvent(callback) {
84
105
  const listener = keywordRNBridgeEmitter.addListener('onKeywordDetectionEvent', (event) => {
85
106
  if (event.instanceId === this.instanceId) {
86
- callback(event.phrase);
107
+ console.log("event == .", event);
108
+ if (Platform.OS === 'ios') {
109
+ console.log("event == .", event);
110
+ callback(event.info);
111
+ } else {
112
+ callback(event.phrase);
113
+ }
87
114
  }
88
115
  });
89
116
  this.listeners.push(listener);