expo-speech-recognition 2.1.4 → 3.0.0
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/CHANGELOG.md +100 -0
- package/README.md +3 -3
- package/android/src/main/java/expo/modules/speechrecognition/ExpoAudioRecorder.kt +54 -14
- package/android/src/main/java/expo/modules/speechrecognition/ExpoSpeechRecognitionModule.kt +8 -3
- package/build/index.d.ts +0 -32
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -13
- package/build/index.js.map +1 -1
- package/eslint.config.mjs +3 -1
- package/package.json +9 -9
- package/src/index.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# expo-speech-recognition
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 3b48113: With this major version change, we've removed some top-level exports from the base `expo-speech-recognition` library.
|
|
8
|
+
Instead you'll now need to call the function directly from `ExpoSpeechRecognitionModule`. This was changed to address
|
|
9
|
+
issues with regards to symbol bindings.
|
|
10
|
+
|
|
11
|
+
The list of removed exports:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// Removed
|
|
15
|
+
import { getSupportedLocales } from "expo-speech-recognition";
|
|
16
|
+
// Instead use:
|
|
17
|
+
ExpoSpeechRecognitionModule.getSupportedLocales();
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// Removed
|
|
22
|
+
import { getSpeechRecognitionServices } from "expo-speech-recognition";
|
|
23
|
+
// Instead use:
|
|
24
|
+
ExpoSpeechRecognitionModule.getSpeechRecognitionServices();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// Removed
|
|
29
|
+
import { supportsOnDeviceRecognition } from "expo-speech-recognition";
|
|
30
|
+
// Instead use:
|
|
31
|
+
ExpoSpeechRecognitionModule.supportsOnDeviceRecognition();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// Removed
|
|
36
|
+
import { supportsRecording } from "expo-speech-recognition";
|
|
37
|
+
// Instead use:
|
|
38
|
+
ExpoSpeechRecognitionModule.supportsRecording();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// Removed
|
|
43
|
+
import { setCategoryIOS } from "expo-speech-recognition";
|
|
44
|
+
// Instead use:
|
|
45
|
+
ExpoSpeechRecognitionModule.setCategoryIOS({ ... });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// Removed
|
|
50
|
+
import { getAudioSessionCategoryAndOptionsIOS } from "expo-speech-recognition";
|
|
51
|
+
// Instead use:
|
|
52
|
+
ExpoSpeechRecognitionModule.getAudioSessionCategoryAndOptionsIOS();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
// Removed
|
|
57
|
+
import { setAudioSessionActiveIOS } from "expo-speech-recognition";
|
|
58
|
+
// Instead use:
|
|
59
|
+
ExpoSpeechRecognitionModule.setAudioSessionActiveIOS(true, { ... });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// Removed
|
|
64
|
+
import { androidTriggerOfflineModelDownload } from "expo-speech-recognition";
|
|
65
|
+
// Instead use:
|
|
66
|
+
ExpoSpeechRecognitionModule.androidTriggerOfflineModelDownload({ ... });
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
// Removed
|
|
71
|
+
import { isRecognitionAvailable } from "expo-speech-recognition";
|
|
72
|
+
// Instead use:
|
|
73
|
+
ExpoSpeechRecognitionModule.isRecognitionAvailable();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
// Removed
|
|
78
|
+
import { getDefaultRecognitionService } from "expo-speech-recognition";
|
|
79
|
+
// Instead use:
|
|
80
|
+
ExpoSpeechRecognitionModule.getDefaultRecognitionService();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
// Removed
|
|
85
|
+
import { getAssistantService } from "expo-speech-recognition";
|
|
86
|
+
// Instead use:
|
|
87
|
+
ExpoSpeechRecognitionModule.getAssistantService();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
// Removed
|
|
92
|
+
import { addSpeechRecognitionListener } from "expo-speech-recognition";
|
|
93
|
+
// Instead use:
|
|
94
|
+
ExpoSpeechRecognitionModule.addListener("foo", (event) => { ... });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 2.1.5
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- 9010d14: Android: Use `VOICE_RECOGNITION` audio source input by default and harden the record loop to gracefully handle read errors
|
|
102
|
+
|
|
3
103
|
## 2.1.4
|
|
4
104
|
|
|
5
105
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -294,9 +294,9 @@ ExpoSpeechRecognitionModule.start({
|
|
|
294
294
|
recordingOptions: {
|
|
295
295
|
// [Default: false] Whether to persist the audio to a local file path.
|
|
296
296
|
persist: false,
|
|
297
|
-
// [Default:
|
|
297
|
+
// [Default: Paths.cache.uri]
|
|
298
298
|
// Changes the default storage location for the audio file.
|
|
299
|
-
// e.g. `
|
|
299
|
+
// e.g. `Paths.document.uri` (from `expo-file-system`)
|
|
300
300
|
outputDirectory: undefined,
|
|
301
301
|
// [Default: `"recording_${timestamp|uuid}.[wav|caf]"`]
|
|
302
302
|
// Changes the file name for the audio file.
|
|
@@ -458,7 +458,7 @@ function RecordAudio() {
|
|
|
458
458
|
recordingOptions: {
|
|
459
459
|
persist: true,
|
|
460
460
|
// Optional: Specify the output file path to save the recording to
|
|
461
|
-
// e.g. `
|
|
461
|
+
// e.g. `Paths.document.uri` (from `expo-file-system`)
|
|
462
462
|
outputDirectory:
|
|
463
463
|
"/data/user/0/expo.modules.speechrecognition.example/files",
|
|
464
464
|
// Optional: Specify the output file name to save the recording to
|
|
@@ -7,7 +7,9 @@ import android.media.AudioRecord
|
|
|
7
7
|
import android.media.MediaRecorder
|
|
8
8
|
import android.os.ParcelFileDescriptor
|
|
9
9
|
import android.os.ParcelFileDescriptor.AutoCloseOutputStream
|
|
10
|
+
import android.os.Build
|
|
10
11
|
import android.util.Log
|
|
12
|
+
import androidx.annotation.RequiresApi
|
|
11
13
|
import java.io.DataOutputStream
|
|
12
14
|
import java.io.File
|
|
13
15
|
import java.io.FileOutputStream
|
|
@@ -26,6 +28,7 @@ interface AudioRecorder {
|
|
|
26
28
|
*
|
|
27
29
|
* Once stopped, the recording stream is written to a wav file for external use
|
|
28
30
|
*/
|
|
31
|
+
@RequiresApi(Build.VERSION_CODES.GINGERBREAD)
|
|
29
32
|
class ExpoAudioRecorder(
|
|
30
33
|
private val context: Context,
|
|
31
34
|
// Optional output file path
|
|
@@ -131,7 +134,7 @@ class ExpoAudioRecorder(
|
|
|
131
134
|
@SuppressLint("MissingPermission")
|
|
132
135
|
private fun createRecorder(): AudioRecord =
|
|
133
136
|
AudioRecord(
|
|
134
|
-
MediaRecorder.AudioSource.
|
|
137
|
+
MediaRecorder.AudioSource.VOICE_RECOGNITION,
|
|
135
138
|
sampleRateInHz,
|
|
136
139
|
channelConfig,
|
|
137
140
|
AudioFormat.ENCODING_PCM_16BIT,
|
|
@@ -194,23 +197,60 @@ class ExpoAudioRecorder(
|
|
|
194
197
|
|
|
195
198
|
private fun streamAudioToPipe() {
|
|
196
199
|
val tempFileOutputStream = FileOutputStream(tempPcmFile)
|
|
197
|
-
val data = ByteArray(bufferSizeInBytes
|
|
200
|
+
val data = ByteArray(bufferSizeInBytes)
|
|
198
201
|
|
|
199
202
|
while (isRecordingAudio) {
|
|
200
|
-
val
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
val recorder = audioRecorder ?: break
|
|
204
|
+
|
|
205
|
+
val read =
|
|
206
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
207
|
+
// avoid empty reads
|
|
208
|
+
recorder.read(data, 0, data.size, AudioRecord.READ_BLOCKING)
|
|
209
|
+
} else {
|
|
210
|
+
recorder.read(data, 0, data.size)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
when {
|
|
214
|
+
read > 0 -> {
|
|
215
|
+
try {
|
|
216
|
+
outputStream?.write(data, 0, read)
|
|
217
|
+
outputStream?.flush()
|
|
205
218
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
// Write to the temp PCM file
|
|
220
|
+
if (outputFilePath != null) {
|
|
221
|
+
tempFileOutputStream.write(data, 0, read)
|
|
222
|
+
tempFileOutputStream.flush()
|
|
223
|
+
}
|
|
224
|
+
} catch (e: IOException) {
|
|
225
|
+
Log.e(TAG, "Failed to write to output stream", e)
|
|
226
|
+
e.printStackTrace()
|
|
210
227
|
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// (this should only happen on API 22 and below)
|
|
231
|
+
read == 0 -> {
|
|
232
|
+
try {
|
|
233
|
+
Thread.sleep(10)
|
|
234
|
+
} catch (_: InterruptedException) {}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
read == AudioRecord.ERROR_DEAD_OBJECT -> {
|
|
238
|
+
Log.w(TAG, "AudioRecord returned ERROR_DEAD_OBJECT; breaking out of the loop")
|
|
239
|
+
// todo: we should probably emit an error event here
|
|
240
|
+
break
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
read == AudioRecord.ERROR_INVALID_OPERATION || read == AudioRecord.ERROR_BAD_VALUE -> {
|
|
244
|
+
Log.w(TAG, "AudioRecord read error: $read; backing off briefly")
|
|
245
|
+
try {
|
|
246
|
+
Thread.sleep(10)
|
|
247
|
+
} catch (_: InterruptedException) {}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
else -> {
|
|
251
|
+
// todo: we should probably emit an error event here
|
|
252
|
+
Log.w(TAG, "AudioRecord read returned '$read'; breaking out of the loop")
|
|
253
|
+
break
|
|
214
254
|
}
|
|
215
255
|
}
|
|
216
256
|
}
|
|
@@ -25,6 +25,8 @@ import expo.modules.kotlin.modules.Module
|
|
|
25
25
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
26
26
|
import java.util.concurrent.Executors
|
|
27
27
|
|
|
28
|
+
private const val TAG = "ESRModule"
|
|
29
|
+
|
|
28
30
|
class ExpoSpeechRecognitionModule : Module() {
|
|
29
31
|
private val expoSpeechService by lazy {
|
|
30
32
|
ExpoSpeechService(appContext.reactContext!!) { name, body ->
|
|
@@ -34,7 +36,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
34
36
|
} catch (e: IllegalArgumentException) {
|
|
35
37
|
// "Cannot create an event emitter for the module that isn't present in the module registry."
|
|
36
38
|
// Likely can occur after destroying the module
|
|
37
|
-
Log.e(
|
|
39
|
+
Log.e(TAG, "Failed to send event: $name", e)
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -42,6 +44,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
42
44
|
// Each module class must implement the definition function. The definition consists of components
|
|
43
45
|
// that describes the module's functionality and behavior.
|
|
44
46
|
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
47
|
+
@RequiresApi(Build.VERSION_CODES.FROYO)
|
|
45
48
|
override fun definition() =
|
|
46
49
|
ModuleDefinition {
|
|
47
50
|
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a
|
|
@@ -162,7 +165,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
AsyncFunction("getSpeechRecognizerPermissionsAsync") { promise: Promise ->
|
|
165
|
-
Log.w(
|
|
168
|
+
Log.w(TAG, "getSpeechRecognizerPermissionsAsync is not supported on Android. Returning a granted permission response.")
|
|
166
169
|
promise.resolve(
|
|
167
170
|
Bundle().apply {
|
|
168
171
|
putString(PermissionsResponse.EXPIRES_KEY, "never")
|
|
@@ -174,7 +177,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
AsyncFunction("requestSpeechRecognizerPermissionsAsync") { promise: Promise ->
|
|
177
|
-
Log.w(
|
|
180
|
+
Log.w(TAG, "requestSpeechRecognizerPermissionsAsync is not supported on Android. Returning a granted permission response.")
|
|
178
181
|
promise.resolve(
|
|
179
182
|
Bundle().apply {
|
|
180
183
|
putString(PermissionsResponse.EXPIRES_KEY, "never")
|
|
@@ -347,6 +350,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
347
350
|
|
|
348
351
|
private fun hasNotGrantedRecordPermissions(): Boolean = appContext.permissions?.hasGrantedPermissions(RECORD_AUDIO)?.not() ?: false
|
|
349
352
|
|
|
353
|
+
@RequiresApi(Build.VERSION_CODES.CUPCAKE)
|
|
350
354
|
private fun getDefaultAssistantService(): ComponentName? {
|
|
351
355
|
val contentResolver = appContext.reactContext?.contentResolver ?: return null
|
|
352
356
|
val defaultAssistant = Settings.Secure.getString(contentResolver, "assistant")
|
|
@@ -356,6 +360,7 @@ class ExpoSpeechRecognitionModule : Module() {
|
|
|
356
360
|
return ComponentName.unflattenFromString(defaultAssistant)
|
|
357
361
|
}
|
|
358
362
|
|
|
363
|
+
@RequiresApi(Build.VERSION_CODES.CUPCAKE)
|
|
359
364
|
private fun getDefaultVoiceRecognitionService(): ComponentName? {
|
|
360
365
|
val contentResolver = appContext.reactContext?.contentResolver ?: return null
|
|
361
366
|
val defaultVoiceRecognitionService = Settings.Secure.getString(contentResolver, "voice_recognition_service")
|
package/build/index.d.ts
CHANGED
|
@@ -2,37 +2,5 @@ export { ExpoWebSpeechRecognition, ExpoWebSpeechGrammar, ExpoWebSpeechGrammarLis
|
|
|
2
2
|
export { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
|
|
3
3
|
export { useSpeechRecognitionEvent } from "./useSpeechRecognitionEvent";
|
|
4
4
|
export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, SpeechRecognizerErrorAndroid, } from "./constants";
|
|
5
|
-
export declare const getSupportedLocales: (options?: {
|
|
6
|
-
androidRecognitionServicePackage?: string;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
locales: string[];
|
|
9
|
-
installedLocales: string[];
|
|
10
|
-
}>;
|
|
11
|
-
export declare const getSpeechRecognitionServices: () => string[];
|
|
12
|
-
export declare const supportsOnDeviceRecognition: () => boolean;
|
|
13
|
-
export declare const supportsRecording: () => boolean;
|
|
14
|
-
export declare const setCategoryIOS: (options: import("./ExpoSpeechRecognitionModule.types").SetCategoryOptions) => void;
|
|
15
|
-
export declare const getAudioSessionCategoryAndOptionsIOS: () => {
|
|
16
|
-
category: import("./ExpoSpeechRecognitionModule.types").AVAudioSessionCategoryValue;
|
|
17
|
-
categoryOptions: import("./ExpoSpeechRecognitionModule.types").AVAudioSessionCategoryOptionsValue[];
|
|
18
|
-
mode: import("./ExpoSpeechRecognitionModule.types").AVAudioSessionModeValue;
|
|
19
|
-
};
|
|
20
|
-
export declare const setAudioSessionActiveIOS: (value: boolean, options?: {
|
|
21
|
-
notifyOthersOnDeactivation: boolean;
|
|
22
|
-
}) => void;
|
|
23
|
-
export declare const androidTriggerOfflineModelDownload: (options: {
|
|
24
|
-
locale: string;
|
|
25
|
-
}) => Promise<{
|
|
26
|
-
status: "download_success" | "opened_dialog" | "download_canceled";
|
|
27
|
-
message: string;
|
|
28
|
-
}>;
|
|
29
|
-
export declare const isRecognitionAvailable: () => boolean;
|
|
30
|
-
export declare const getDefaultRecognitionService: () => {
|
|
31
|
-
packageName: string;
|
|
32
|
-
};
|
|
33
|
-
export declare const getAssistantService: () => {
|
|
34
|
-
packageName: string;
|
|
35
|
-
};
|
|
36
|
-
export declare const addSpeechRecognitionListener: <EventName extends keyof import("./ExpoSpeechRecognitionModule.types").ExpoSpeechRecognitionNativeEventMap>(eventName: EventName, listener: import("./ExpoSpeechRecognitionModule.types").ExpoSpeechRecognitionNativeEvents[EventName]) => import("expo-modules-core/build/ts-declarations/EventEmitter").EventSubscription;
|
|
37
5
|
export type { ExpoSpeechRecognitionOptions, AndroidIntentOptions, ExpoSpeechRecognitionNativeEventMap, AVAudioSessionCategoryOptionsValue, AVAudioSessionModeValue, AVAudioSessionCategoryValue, AudioEncodingAndroidValue, AudioSourceOptions, RecordingOptions, IOSTaskHintValue, SetCategoryOptions, ExpoSpeechRecognitionErrorCode, ExpoSpeechRecognitionErrorEvent, ExpoSpeechRecognitionResultEvent, ExpoSpeechRecognitionResult, ExpoSpeechRecognitionResultSegment, } from "./ExpoSpeechRecognitionModule.types";
|
|
38
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EAClB,kCAAkC,EAClC,oCAAoC,EACpC,oBAAoB,EACpB,WAAW,EACX,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,mCAAmC,EACnC,kCAAkC,EAClC,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAChC,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,qCAAqC,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
|
|
2
1
|
// Export the SpeechRecognition APIs
|
|
3
2
|
export { ExpoWebSpeechRecognition, ExpoWebSpeechGrammar, ExpoWebSpeechGrammarList, } from "./ExpoWebSpeechRecognition";
|
|
4
3
|
// Native module
|
|
@@ -7,16 +6,4 @@ export { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
|
|
|
7
6
|
export { useSpeechRecognitionEvent } from "./useSpeechRecognitionEvent";
|
|
8
7
|
// Constants
|
|
9
8
|
export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, SpeechRecognizerErrorAndroid, } from "./constants";
|
|
10
|
-
export const getSupportedLocales = (options) => ExpoSpeechRecognitionModule.getSupportedLocales(options ?? {});
|
|
11
|
-
export const getSpeechRecognitionServices = ExpoSpeechRecognitionModule.getSpeechRecognitionServices;
|
|
12
|
-
export const supportsOnDeviceRecognition = ExpoSpeechRecognitionModule.supportsOnDeviceRecognition;
|
|
13
|
-
export const supportsRecording = ExpoSpeechRecognitionModule.supportsRecording;
|
|
14
|
-
export const setCategoryIOS = ExpoSpeechRecognitionModule.setCategoryIOS;
|
|
15
|
-
export const getAudioSessionCategoryAndOptionsIOS = ExpoSpeechRecognitionModule.getAudioSessionCategoryAndOptionsIOS;
|
|
16
|
-
export const setAudioSessionActiveIOS = ExpoSpeechRecognitionModule.setAudioSessionActiveIOS;
|
|
17
|
-
export const androidTriggerOfflineModelDownload = ExpoSpeechRecognitionModule.androidTriggerOfflineModelDownload;
|
|
18
|
-
export const isRecognitionAvailable = ExpoSpeechRecognitionModule.isRecognitionAvailable;
|
|
19
|
-
export const getDefaultRecognitionService = ExpoSpeechRecognitionModule.getDefaultRecognitionService;
|
|
20
|
-
export const getAssistantService = ExpoSpeechRecognitionModule.getAssistantService;
|
|
21
|
-
export const addSpeechRecognitionListener = ExpoSpeechRecognitionModule.addListener;
|
|
22
9
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,QAAQ;AACR,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,YAAY;AACZ,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EAClB,kCAAkC,EAClC,oCAAoC,EACpC,oBAAoB,EACpB,WAAW,EACX,4BAA4B,GAC7B,MAAM,aAAa,CAAC","sourcesContent":["// Export the SpeechRecognition APIs\nexport {\n ExpoWebSpeechRecognition,\n ExpoWebSpeechGrammar,\n ExpoWebSpeechGrammarList,\n} from \"./ExpoWebSpeechRecognition\";\n\n// Native module\nexport { ExpoSpeechRecognitionModule } from \"./ExpoSpeechRecognitionModule\";\n\n// Hooks\nexport { useSpeechRecognitionEvent } from \"./useSpeechRecognitionEvent\";\n\n// Constants\nexport {\n AVAudioSessionCategory,\n AVAudioSessionCategoryOptions,\n AVAudioSessionMode,\n RecognizerIntentExtraLanguageModel,\n RecognizerIntentEnableLanguageSwitch,\n AudioEncodingAndroid,\n TaskHintIOS,\n SpeechRecognizerErrorAndroid,\n} from \"./constants\";\n\nexport type {\n ExpoSpeechRecognitionOptions,\n AndroidIntentOptions,\n ExpoSpeechRecognitionNativeEventMap,\n AVAudioSessionCategoryOptionsValue,\n AVAudioSessionModeValue,\n AVAudioSessionCategoryValue,\n AudioEncodingAndroidValue,\n AudioSourceOptions,\n RecordingOptions,\n IOSTaskHintValue,\n SetCategoryOptions,\n ExpoSpeechRecognitionErrorCode,\n ExpoSpeechRecognitionErrorEvent,\n ExpoSpeechRecognitionResultEvent,\n ExpoSpeechRecognitionResult,\n ExpoSpeechRecognitionResultSegment,\n} from \"./ExpoSpeechRecognitionModule.types\";\n"]}
|
package/eslint.config.mjs
CHANGED
|
@@ -6,9 +6,11 @@ import tseslint from "typescript-eslint";
|
|
|
6
6
|
export default tseslint.config([
|
|
7
7
|
tseslint.configs.recommended,
|
|
8
8
|
js.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
ignores: ["build/**", "app.plugin.js", "example/**"],
|
|
11
|
+
},
|
|
9
12
|
{
|
|
10
13
|
files: ["src/**/*.{js,jsx,ts,tsx}"],
|
|
11
|
-
ignores: ["build/**"],
|
|
12
14
|
languageOptions: {
|
|
13
15
|
globals: globals.node,
|
|
14
16
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-speech-recognition",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Speech Recognition for React Native Expo projects",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"homepage": "https://github.com/jamsch/expo-speech-recognition#readme",
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@changesets/cli": "^2.29.
|
|
44
|
-
"@types/dom-speech-recognition": "^0.0.
|
|
45
|
-
"@types/react": "~19.
|
|
46
|
-
"expo": "~
|
|
47
|
-
"expo-module-scripts": "^
|
|
48
|
-
"globals": "16.
|
|
49
|
-
"typescript": "~5.
|
|
50
|
-
"typescript-eslint": "8.
|
|
43
|
+
"@changesets/cli": "^2.29.7",
|
|
44
|
+
"@types/dom-speech-recognition": "^0.0.7",
|
|
45
|
+
"@types/react": "~19.1.15",
|
|
46
|
+
"expo": "~54.0.0",
|
|
47
|
+
"expo-module-scripts": "^5.0.7",
|
|
48
|
+
"globals": "16.4.0",
|
|
49
|
+
"typescript": "~5.9.3",
|
|
50
|
+
"typescript-eslint": "8.46.3"
|
|
51
51
|
},
|
|
52
52
|
"prettier": {
|
|
53
53
|
"trailingComma": "all"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
|
|
2
|
-
|
|
3
1
|
// Export the SpeechRecognition APIs
|
|
4
2
|
export {
|
|
5
3
|
ExpoWebSpeechRecognition,
|
|
@@ -25,41 +23,6 @@ export {
|
|
|
25
23
|
SpeechRecognizerErrorAndroid,
|
|
26
24
|
} from "./constants";
|
|
27
25
|
|
|
28
|
-
export const getSupportedLocales = (options?: {
|
|
29
|
-
androidRecognitionServicePackage?: string;
|
|
30
|
-
}) => ExpoSpeechRecognitionModule.getSupportedLocales(options ?? {});
|
|
31
|
-
|
|
32
|
-
export const getSpeechRecognitionServices =
|
|
33
|
-
ExpoSpeechRecognitionModule.getSpeechRecognitionServices;
|
|
34
|
-
|
|
35
|
-
export const supportsOnDeviceRecognition =
|
|
36
|
-
ExpoSpeechRecognitionModule.supportsOnDeviceRecognition;
|
|
37
|
-
|
|
38
|
-
export const supportsRecording = ExpoSpeechRecognitionModule.supportsRecording;
|
|
39
|
-
|
|
40
|
-
export const setCategoryIOS = ExpoSpeechRecognitionModule.setCategoryIOS;
|
|
41
|
-
|
|
42
|
-
export const getAudioSessionCategoryAndOptionsIOS =
|
|
43
|
-
ExpoSpeechRecognitionModule.getAudioSessionCategoryAndOptionsIOS;
|
|
44
|
-
|
|
45
|
-
export const setAudioSessionActiveIOS =
|
|
46
|
-
ExpoSpeechRecognitionModule.setAudioSessionActiveIOS;
|
|
47
|
-
|
|
48
|
-
export const androidTriggerOfflineModelDownload =
|
|
49
|
-
ExpoSpeechRecognitionModule.androidTriggerOfflineModelDownload;
|
|
50
|
-
|
|
51
|
-
export const isRecognitionAvailable =
|
|
52
|
-
ExpoSpeechRecognitionModule.isRecognitionAvailable;
|
|
53
|
-
|
|
54
|
-
export const getDefaultRecognitionService =
|
|
55
|
-
ExpoSpeechRecognitionModule.getDefaultRecognitionService;
|
|
56
|
-
|
|
57
|
-
export const getAssistantService =
|
|
58
|
-
ExpoSpeechRecognitionModule.getAssistantService;
|
|
59
|
-
|
|
60
|
-
export const addSpeechRecognitionListener =
|
|
61
|
-
ExpoSpeechRecognitionModule.addListener;
|
|
62
|
-
|
|
63
26
|
export type {
|
|
64
27
|
ExpoSpeechRecognitionOptions,
|
|
65
28
|
AndroidIntentOptions,
|