react-native-wakeword 1.1.21 → 1.1.22
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/assets/coca_cola_model_28_05052025.onnx +0 -0
- package/android/src/main/java/com/davoice/keywordspotting/KeyWordRNBridge.java +45 -3
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/Info.plist +5 -5
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +4 -1
- 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 +345 -122
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +5 -3
- 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 +5 -3
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +8 -2
- 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 +345 -122
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +5 -3
- 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 +5 -3
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +345 -122
- package/ios/KeyWordRNBridge/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +5 -3
- 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 +5 -3
- 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.mm +64 -0
- package/ios/KeyWordRNBridge/models/coca_cola_model_28_05052025.onnx +0 -0
- package/package.json +1 -1
- package/wakewords/KeyWordRNBridge.d.ts +1 -0
- package/wakewords/KeyWordRNBridge.js +24 -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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/KeyWordDetection-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
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
|
-
|
|
17
|
+
sSoVDG0TLK7+xwNThNe8Ny1Omu0=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
BLS7GdwnCockvW92Rfk1ffxnSdc=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
Oin84KT6uz+Dz5zyaKdFqrTHEuY=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
pZsSKXuNOvF3YTKH6zkbn+hGvYg=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
Oin84KT6uz+Dz5zyaKdFqrTHEuY=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
GPjpEF/igGhjAM0wpZyiMsndHys=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
BLS7GdwnCockvW92Rfk1ffxnSdc=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
44
44
|
<data>
|
|
45
|
-
|
|
45
|
+
thI3UPX8hf9jbWYqnJfUg5vy1p8=
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
obKcLl48LCRITPrTt9lIXud6M8A=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
thI3UPX8hf9jbWYqnJfUg5vy1p8=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
56
56
|
<data>
|
|
57
|
-
|
|
57
|
+
QYCh9Gleq504mkb3Q1TYFsdTQ/E=
|
|
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
|
-
|
|
70
|
+
2LuxvPIzEv/mCjRCRJQR1iQMgJI=
|
|
71
71
|
</data>
|
|
72
72
|
<key>hash2</key>
|
|
73
73
|
<data>
|
|
74
|
-
+
|
|
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
|
-
|
|
92
|
+
BLS7GdwnCockvW92Rfk1ffxnSdc=
|
|
93
93
|
</data>
|
|
94
94
|
<key>hash2</key>
|
|
95
95
|
<data>
|
|
96
|
-
|
|
96
|
+
rxlcsSVQPKp4oOIUhXBI6qIi0L8k5o9a6YR/wLGJusQ=
|
|
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
|
-
|
|
103
|
+
Oin84KT6uz+Dz5zyaKdFqrTHEuY=
|
|
104
104
|
</data>
|
|
105
105
|
<key>hash2</key>
|
|
106
106
|
<data>
|
|
107
|
-
|
|
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
|
-
|
|
114
|
+
pZsSKXuNOvF3YTKH6zkbn+hGvYg=
|
|
115
115
|
</data>
|
|
116
116
|
<key>hash2</key>
|
|
117
117
|
<data>
|
|
118
|
-
|
|
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
|
-
|
|
125
|
+
Oin84KT6uz+Dz5zyaKdFqrTHEuY=
|
|
126
126
|
</data>
|
|
127
127
|
<key>hash2</key>
|
|
128
128
|
<data>
|
|
129
|
-
|
|
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
|
-
|
|
136
|
+
GPjpEF/igGhjAM0wpZyiMsndHys=
|
|
137
137
|
</data>
|
|
138
138
|
<key>hash2</key>
|
|
139
139
|
<data>
|
|
140
|
-
|
|
140
|
+
PGimumdKzZCu1MKnTinL1AIl92xU0z0JwNiDs0oTjVk=
|
|
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
|
-
|
|
147
|
+
BLS7GdwnCockvW92Rfk1ffxnSdc=
|
|
148
148
|
</data>
|
|
149
149
|
<key>hash2</key>
|
|
150
150
|
<data>
|
|
151
|
-
|
|
151
|
+
rxlcsSVQPKp4oOIUhXBI6qIi0L8k5o9a6YR/wLGJusQ=
|
|
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
|
-
|
|
158
|
+
thI3UPX8hf9jbWYqnJfUg5vy1p8=
|
|
159
159
|
</data>
|
|
160
160
|
<key>hash2</key>
|
|
161
161
|
<data>
|
|
162
|
-
|
|
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
|
-
|
|
169
|
+
obKcLl48LCRITPrTt9lIXud6M8A=
|
|
170
170
|
</data>
|
|
171
171
|
<key>hash2</key>
|
|
172
172
|
<data>
|
|
173
|
-
|
|
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
|
-
|
|
180
|
+
thI3UPX8hf9jbWYqnJfUg5vy1p8=
|
|
181
181
|
</data>
|
|
182
182
|
<key>hash2</key>
|
|
183
183
|
<data>
|
|
184
|
-
|
|
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
|
-
|
|
191
|
+
QYCh9Gleq504mkb3Q1TYFsdTQ/E=
|
|
192
192
|
</data>
|
|
193
193
|
<key>hash2</key>
|
|
194
194
|
<data>
|
|
195
|
-
|
|
195
|
+
/at1gZWt2gLuRLlE0RPJa4MS0AqCzd2maWvJm9gx7Ww=
|
|
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]) {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ 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>;
|
|
@@ -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,
|
|
@@ -83,7 +100,13 @@ export class KeyWordRNBridgeInstance {
|
|
|
83
100
|
onKeywordDetectionEvent(callback) {
|
|
84
101
|
const listener = keywordRNBridgeEmitter.addListener('onKeywordDetectionEvent', (event) => {
|
|
85
102
|
if (event.instanceId === this.instanceId) {
|
|
86
|
-
|
|
103
|
+
console.log("event == .", event);
|
|
104
|
+
if (Platform.OS === 'ios') {
|
|
105
|
+
console.log("event == .", event);
|
|
106
|
+
callback(event.info);
|
|
107
|
+
} else {
|
|
108
|
+
callback(event.phrase);
|
|
109
|
+
}
|
|
87
110
|
}
|
|
88
111
|
});
|
|
89
112
|
this.listeners.push(listener);
|