expo-speech-recognition 2.1.2 → 2.1.4

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 CHANGED
@@ -1,5 +1,46 @@
1
1
  # expo-speech-recognition
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - a3aef4e: Add native event error codes for Android.
8
+
9
+ For advanced use cases where you'd like to debug the platform's underlying speech recognizer you can now access `event.code` from the error event. For Android, you can import the `SpeechRecognizerErrorAndroid` enum to match against this code.
10
+
11
+ Error codes with the value of `-1` are thrown by this library and not by the `SpeechRecognizer`.
12
+
13
+ Example use case: differentiating between `ERROR_NETWORK` and `ERROR_NETWORK_TIMEOUT` are currently mapped to `network` on `event.error`. With this change you can now use `event.code` to see the exact error that was thrown.
14
+
15
+ ```ts
16
+ import {
17
+ SpeechRecognizerErrorAndroid,
18
+ useSpeechRecognitionEvent,
19
+ } from "expo-speech-recognition";
20
+
21
+ useSpeechRecognitionEvent("error", (event) => {
22
+ if (Platform.OS === "android") {
23
+ switch (event.code) {
24
+ case SpeechRecognizerErrorAndroid.ERROR_NETWORK:
25
+ break;
26
+ case SpeechRecognizerErrorAndroid.ERROR_NETWORK_TIMEOUT:
27
+ break;
28
+ case -1:
29
+ // An error usually thrown by the this library
30
+ break;
31
+ }
32
+ }
33
+ });
34
+ ```
35
+
36
+ ## 2.1.3
37
+
38
+ ### Patch Changes
39
+
40
+ - 86b0b5b: Fixed an Android unhandled `ArrayIndexOutOfBoundsException` crash when the audio recording fails.
41
+
42
+ This may happen when [`audioRecorder.read()`](<https://developer.android.com/reference/android/media/AudioRecord#read(short[],%20int,%20int,%20int)>) returns [`ERROR_INVALID_OPERATION`](https://developer.android.com/reference/android/media/AudioRecord#ERROR_INVALID_OPERATION), [`ERROR_BAD_VALUE`](https://developer.android.com/reference/android/media/AudioRecord#ERROR_BAD_VALUE), [`ERROR_DEAD_OBJECT`](https://developer.android.com/reference/android/media/AudioRecord#ERROR_DEAD_OBJECT), or the more generic [`ERROR`](https://developer.android.com/reference/android/media/AudioRecord#ERROR)
43
+
3
44
  ## 2.1.2
4
45
 
5
46
  ### Patch Changes
package/README.md CHANGED
@@ -15,6 +15,7 @@ expo-speech-recognition implements the iOS [`SFSpeechRecognizer`](https://develo
15
15
  - [Direct module API](#direct-module-api)
16
16
  - [Speech Recognition Events](#speech-recognition-events)
17
17
  - [Handling Errors](#handling-errors)
18
+ - [Advanced error handling](#advanced-error-handling)
18
19
  - [Persisting Audio Recordings](#persisting-audio-recordings)
19
20
  - [Transcribing audio files](#transcribing-audio-files)
20
21
  - [Supported input audio formats](#supported-input-audio-formats)
@@ -403,6 +404,25 @@ The error code is based on the [Web Speech API error codes](https://developer.mo
403
404
  | `speech-timeout` | (Android) No speech input. |
404
405
  | `unknown` | (Android) Unknown error |
405
406
 
407
+ ### Advanced error handling
408
+
409
+ Alongside the the mapped web-speech API error name, you can also access the `error.code` field to get the platform's underlying native error code.
410
+
411
+ This is currently supported on Android only.
412
+
413
+ ```ts
414
+ import {
415
+ SpeechRecognizerErrorAndroid,
416
+ useSpeechRecognitionEvent,
417
+ } from "expo-speech-recognition";
418
+
419
+ useSpeechRecognitionEvent("error", (event) => {
420
+ if (event.code === SpeechRecognizerErrorAndroid.ERROR_NETWORK_TIMEOUT) {
421
+ // do something
422
+ }
423
+ });
424
+ ```
425
+
406
426
  ## Persisting Audio Recordings
407
427
 
408
428
  If you would like to persist the recognized audio for later use, you can enable the `recordingOptions.persist` option when calling `start()`. Enabling this setting will emit an `{ uri: string }` event object in the `audiostart` and `audioend` events with the local file path.
@@ -198,18 +198,20 @@ class ExpoAudioRecorder(
198
198
 
199
199
  while (isRecordingAudio) {
200
200
  val read = audioRecorder!!.read(data, 0, data.size)
201
- try {
202
- outputStream?.write(data, 0, read)
203
- outputStream?.flush()
204
-
205
- // Write to the temp PCM file
206
- if (outputFilePath != null) {
207
- tempFileOutputStream.write(data, 0, read)
208
- tempFileOutputStream.flush()
201
+ if (read > 0) {
202
+ try {
203
+ outputStream?.write(data, 0, read)
204
+ outputStream?.flush()
205
+
206
+ // Write to the temp PCM file
207
+ if (outputFilePath != null) {
208
+ tempFileOutputStream.write(data, 0, read)
209
+ tempFileOutputStream.flush()
210
+ }
211
+ } catch (e: IOException) {
212
+ Log.e(TAG, "Failed to write to output stream", e)
213
+ e.printStackTrace()
209
214
  }
210
- } catch (e: IOException) {
211
- Log.e(TAG, "Failed to write to output stream", e)
212
- e.printStackTrace()
213
215
  }
214
216
  }
215
217
  tempFileOutputStream.close()
@@ -201,7 +201,7 @@ class ExpoSpeechRecognitionModule : Module() {
201
201
  /** Start recognition with args: lang, interimResults, maxAlternatives */
202
202
  Function("start") { options: SpeechRecognitionOptions ->
203
203
  if (hasNotGrantedRecordPermissions()) {
204
- sendEvent("error", mapOf("error" to "not-allowed", "message" to "Missing RECORD_AUDIO permissions."))
204
+ sendEvent("error", mapOf("error" to "not-allowed", "message" to "Missing RECORD_AUDIO permissions.", "code" to -1))
205
205
  sendEvent("end")
206
206
  return@Function
207
207
  }
@@ -213,7 +213,7 @@ class ExpoSpeechRecognitionModule : Module() {
213
213
  }
214
214
 
215
215
  Function("abort") {
216
- sendEvent("error", mapOf("error" to "aborted", "message" to "Speech recognition aborted."))
216
+ sendEvent("error", mapOf("error" to "aborted", "message" to "Speech recognition aborted.", "code" to -1))
217
217
  expoSpeechService.abort()
218
218
  }
219
219
 
@@ -157,7 +157,7 @@ class ExpoSpeechService(
157
157
  }
158
158
  e.printStackTrace()
159
159
  log("Failed to create Speech Recognizer with error: $errorMessage")
160
- sendEvent("error", mapOf("error" to "audio-capture", "message" to errorMessage))
160
+ sendEvent("error", mapOf("error" to "audio-capture", "message" to errorMessage, "code" to -1))
161
161
  teardownAndEnd()
162
162
  }
163
163
  }
@@ -521,7 +521,7 @@ class ExpoSpeechService(
521
521
  sendEvent("nomatch", null)
522
522
  }
523
523
 
524
- sendEvent("error", mapOf("error" to errorInfo.error, "message" to errorInfo.message))
524
+ sendEvent("error", mapOf("error" to errorInfo.error, "message" to errorInfo.message, "code" to error))
525
525
  teardownAndEnd(RecognitionState.ERROR)
526
526
  log("onError() - ${errorInfo.error}: ${errorInfo.message} - code: $error")
527
527
  }
@@ -703,7 +703,7 @@ class ExpoSpeechService(
703
703
  // Extra codes
704
704
  SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "speech-timeout"
705
705
  SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "busy"
706
- SpeechRecognizer.ERROR_TOO_MANY_REQUESTS -> "busy"
706
+ SpeechRecognizer.ERROR_TOO_MANY_REQUESTS -> "too-many-requests"
707
707
  else -> "unknown"
708
708
  }
709
709
 
@@ -722,7 +722,7 @@ class ExpoSpeechService(
722
722
  "Requested language is not available to be used with the current recognizer."
723
723
  // Extra codes/messages
724
724
  SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "RecognitionService busy."
725
- SpeechRecognizer.ERROR_TOO_MANY_REQUESTS -> "Too many requests."
725
+ SpeechRecognizer.ERROR_TOO_MANY_REQUESTS -> "Too many requests from the same client."
726
726
  SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "No speech input."
727
727
  else -> "Unknown error"
728
728
  }
@@ -79,6 +79,15 @@ export type ExpoSpeechRecognitionErrorCode =
79
79
  export type ExpoSpeechRecognitionErrorEvent = {
80
80
  error: ExpoSpeechRecognitionErrorCode;
81
81
  message: string;
82
+ /**
83
+ * The underlying native error code from the platform-specific speech recognition service.
84
+ *
85
+ * - On Android: Maps to SpeechRecognizer error constants (e.g., ERROR_AUDIO = 3)
86
+ * - Value of -1 indicates a generic/unknown error or when native code is not available
87
+ *
88
+ * Usually you won't need this field, but it can be useful for debugging purposes.
89
+ */
90
+ code?: number;
82
91
  };
83
92
  export type LanguageDetectionEvent = {
84
93
  /** The language that was detected, in BCP-47 format. e.g. "en-US", "de-DE" */
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSpeechRecognitionModule.types.d.ts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B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE;QACR,4FAA4F;QAC5F,0BAA0B,EAAE,OAAO,CAAC;KACrC,GACA,IAAI;IACP;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,sBAAsB,CAAC;CACjD;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,2BAA2B,CAAC;IACtC,eAAe,EAAE,kCAAkC,EAAE,CAAC;IACtD,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC,CAAC;AAEF,KAAK,sBAAsB,GACvB,UAAU,GACV,UAAU,GACV,aAAa,GACb,UAAU,CAAC;AAEf;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAC5C,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"ExpoSpeechRecognitionModule.types.d.ts","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,MAAM,MAAM,uCAAuC,GAAG,kBAAkB,GAAG;IACzE;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EAClB,oCAAoC,EACpC,kCAAkC,EAClC,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,2BAA2B,GACrC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE,MAAM,MAAM,2BAA2B,GAAG;IACxC,U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;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSpeechRecognitionModule.types.js","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionResponse } from \"expo-modules-core\";\nimport type { NativeModule } from \"expo\";\n\nexport type ExpoSpeechRecognitionPermissionResponse = PermissionResponse & {\n /**\n * Whether the speech recognition is restricted by Content & Privacy Restrictions.\n *\n * This value corresponds to the `restricted` enum of `SFSpeechRecognizer.authorizationStatus()`.\n *\n * This is only available on iOS.\n */\n restricted?: boolean;\n};\n\nimport type {\n AudioEncodingAndroid,\n AVAudioSessionCategory,\n AVAudioSessionCategoryOptions,\n AVAudioSessionMode,\n RecognizerIntentEnableLanguageSwitch,\n RecognizerIntentExtraLanguageModel,\n TaskHintIOS,\n} from \"./constants\";\n\nexport type AVAudioSessionCategoryValue =\n (typeof AVAudioSessionCategory)[keyof typeof AVAudioSessionCategory];\n\nexport type ExpoSpeechRecognitionResult = {\n transcript: string;\n /**\n * Value ranging between between 0.0, 1.0, and -1 (unavailable) indicating transcript confidence.\n */\n confidence: number;\n /**\n * An array of transcription segments that represent the parts of the transcription, as identified by the speech recognizer.\n *\n * Notes for Android:\n *\n * - This is only available for SDK 34+ (Android 14+)\n * - This is only verified to work with the `com.google.android.as` service (using on device speech recognition)\n * - Segments are only available during the final result\n * - The segment parts are split up by words.\n * - The segments are only available for the first transcript\n * - Segment confidences currently return as -1 (unavailable)\n *\n * Notes for iOS:\n *\n * - The confidence value will be 0 on partial results\n */\n segments: ExpoSpeechRecognitionResultSegment[];\n};\n\nexport type ExpoSpeechRecognitionResultSegment = {\n /** The start timestamp of the utterance, e.g. 1000 */\n startTimeMillis: number;\n /** The end timestamp of the utterance, e.g. 1500 */\n endTimeMillis: number;\n /** The text portion of the transcript, e.g. \"Hello world\" */\n segment: string;\n /** Value ranging between between 0.0, 1.0, and -1 (unavailable) indicating the confidence of the specific segment */\n confidence: number;\n};\n\n/** Fired when there's a speech result. The result may be partial or final */\nexport type ExpoSpeechRecognitionResultEvent = {\n isFinal: boolean;\n results: ExpoSpeechRecognitionResult[];\n};\n\nexport type ExpoSpeechRecognitionErrorCode =\n /** The user called `ExpoSpeechRecognitionModule.abort()`. */\n | \"aborted\"\n /** Audio recording error. */\n | \"audio-capture\"\n /** There was an error in the speech recognition grammar or semantic tags, or the chosen grammar format or semantic tag format was unsupported. */\n | \"bad-grammar\"\n /** Locale is not supported by the speech recognizer. */\n | \"language-not-supported\"\n /** Network communication required for completing the recognition failed. */\n | \"network\"\n /** No final speech was detected. */\n | \"no-speech\"\n /** Permission to use speech recognition or microphone was not granted. */\n | \"not-allowed\"\n /** Recognizer is unavailable. */\n | \"service-not-allowed\"\n // Extra codes (not part of the spec)\n /** The recognizer is busy and cannot accept any new recognition requests. */\n | \"busy\"\n /** (Android only) An unknown client-side error occurred. */\n | \"client\"\n /** (Android) No speech input. */\n | \"speech-timeout\"\n /** (Android) Unknown error */\n | \"unknown\";\n\nexport type ExpoSpeechRecognitionErrorEvent = {\n error: ExpoSpeechRecognitionErrorCode;\n message: string;\n};\n\nexport type LanguageDetectionEvent = {\n /** The language that was detected, in BCP-47 format. e.g. \"en-US\", \"de-DE\" */\n detectedLanguage: string;\n /** The confidence of the detected language. A value ranging between 0.0 and 1.0.\n *\n * Values range from:\n *\n * - 1.0 (highly confident)\n * - 0.8 (confident)\n * - 0.5 (not confident)\n * - 0.0 (unknown)\n */\n confidence: number;\n /** The alternative locales for the same language, in BCP-47 format. e.g. [\"en-US\", \"en-GB\"] */\n topLocaleAlternatives: string[];\n};\n\n/**\n * Events that are dispatched from the native side\n */\nexport type ExpoSpeechRecognitionNativeEventMap = {\n result: ExpoSpeechRecognitionResultEvent;\n error: ExpoSpeechRecognitionErrorEvent;\n start: null;\n speechstart: null;\n speechend: null;\n /** A final result is returned with no significant recognition */\n nomatch: null;\n /** Audio capturing had started */\n audiostart: {\n /**\n * The uri is set when `recordingOptions.persist` is enabled.\n * Do not attempt to use this file until the `audioend` event is emitted.\n *\n * Example URIs:\n *\n * - Android: `file:///data/user/0/expo.modules.speechrecognition.example/cache/recording_1720678500903.wav`\n * - iOS: `file:///path/to/Library/Caches/audio_CD5E6C6C-3D9D-4754-9188-D6FAF97D9DF2.wav`\n */\n uri: string | null;\n };\n /** Audio capturing had ended */\n audioend: {\n /**\n * The uri is set when `recordingOptions.persist` is enabled.\n *\n * Example URIs:\n *\n * - Android: `file:///data/user/0/expo.modules.speechrecognition.example/cache/recording_1720678500903.wav`\n * - iOS: `file:///path/to/Library/Caches/audio_CD5E6C6C-3D9D-4754-9188-D6FAF97D9DF2.wav`\n */\n uri: string | null;\n };\n end: null;\n soundstart: null;\n soundend: null;\n languagedetection: LanguageDetectionEvent;\n volumechange: {\n /**\n * A float value between -2 and 10 indicating the volume of the input audio\n *\n * Consider anything below 0 to be inaudible\n */\n value: number;\n };\n};\n\nexport type ExpoSpeechRecognitionOptions = {\n /** [Default: \"en-US\"] The language of the speech recognition */\n lang?: string;\n /** [Default: false] Note for iOS: final results are only available after speech recognition has stopped */\n interimResults?: boolean;\n /** [Default: 5] The maximum number of alternative transcriptions to return. */\n maxAlternatives?: number;\n /**\n * An array of strings that will be used to provide context to the speech recognition engine.\n *\n * On Android, this configures [`EXTRA_BIASING_STRINGS`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_BIASING_STRINGS) in the recognizer intent (API level 33+).\n *\n * On iOS, this configures [`SFSpeechRecognitionRequest.contextualStrings`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/1649391-contextualstrings).\n */\n contextualStrings?: string[];\n /**\n * [Default: false] Continuous recognition.\n *\n * Not supported on Android 12 and below.\n *\n * If false, the behaviors are the following:\n *\n * - on iOS 17-, recognition will run until no speech is detected for 3 seconds.\n * - on iOS 18+ and Android, recognition will run until a result with `isFinal: true` is received.\n */\n continuous?: boolean;\n /** [Default: false] Prevent device from sending audio over the network. Only enabled if the device supports it.\n *\n * Use `getSupportedLocales()` to verify if the locale is installed on the device prior to enabling this option.\n */\n requiresOnDeviceRecognition?: boolean;\n /**\n * [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.\n *\n * On Android, this configures [`EXTRA_ENABLE_FORMATTING`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING) in the recognizer intent (Android 13+, API level 33+).\n *\n * Note for Android: This feature is only verified to work on Android 13+ with on-device speech recognition enabled (i.e. enabling `requiresOnDeviceRecognition` or using the `com.google.android.as` service package)\n *\n * On iOS, this configures [`SFSpeechRecognitionRequest.addsPunctuation`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/3930023-addspunctuation).\n */\n addsPunctuation?: boolean;\n /**\n * The package name of the speech recognition service to use.\n * If not provided, the default service will be used.\n *\n * Obtain the supported packages by running `ExpoSpeechRecognitionModule.getSpeechRecognitionServices()`\n *\n * e.g. \"com.google.android.as\" or \"com.samsung.android.bixby.agent\"\n */\n androidRecognitionServicePackage?: string;\n /**\n * Extra options to provide to the Android Recognition intent.\n *\n * For a full list of options, see https://developer.android.com/reference/android/speech/RecognizerIntent\n */\n androidIntentOptions?: Partial<AndroidIntentOptions>;\n /**\n * Audio source options to pass to the recognizer.\n *\n * This option can be used to recognize audio from a local or remote file URI.\n */\n audioSource?: AudioSourceOptions;\n /**\n * Audio recording options for persisting the audio to a local file path.\n */\n recordingOptions?: RecordingOptions;\n /**\n * Default: `\"android.speech.action.RECOGNIZE_SPEECH\"`\n *\n * The kind of intent action\n *\n * Intents:\n *\n * - [`android.speech.action.RECOGNIZE_SPEECH`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_RECOGNIZE_SPEECH) which performs speech recognition (default)\n * - [`android.speech.action.VOICE_SEARCH_HANDS_FREE`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_VOICE_SEARCH_HANDS_FREE) - prompts the user for speech without requiring the user's visual attention or touch input\n * - [`android.speech.action.WEB_SEARCH`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_WEB_SEARCH) - displays a web search result or trigger another type of action based on the user's speech.\n */\n androidIntent?:\n | \"android.speech.action.RECOGNIZE_SPEECH\"\n | \"android.speech.action.VOICE_SEARCH_HANDS_FREE\"\n | \"android.speech.action.WEB_SEARCH\";\n\n /**\n * The hint for the speech recognition task.\n *\n * Default: `\"unspecified\"`\n *\n * Docs: https://developer.apple.com/documentation/speech/sfspeechrecognitiontaskhint\n */\n iosTaskHint?: IOSTaskHintValue;\n\n /**\n * The audio category for the speech recognition task.\n *\n * Use this option to configure the default audio session category and mode prior to starting speech recognition.\n *\n * **Caution:** confirm that the category, options and mode are compatible with the audio source.\n *\n * By default, the audio session category and mode are set to:\n *\n * - category: `playAndRecord`\n * - options: `defaultToSpeaker` and `allowBluetooth`\n * - mode: `measurement`\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category\n */\n iosCategory?: SetCategoryOptions;\n\n /**\n * Settings for volume change events.\n */\n volumeChangeEventOptions?: {\n /**\n * Whether to emit volume change events.\n *\n * Default: false\n */\n enabled?: boolean;\n /**\n * Specifies the interval (in milliseconds) to emit `volumechange` events.\n *\n * Default: 100ms on iOS\n *\n * Increasing this value will improve performance\n */\n intervalMillis?: number;\n };\n\n /**\n * [iOS only] Enabling this option will prevent microphone feedback.\n *\n * When enabled, extra signal processing is applied on the incoming audio, and any audio that is coming from the device is taken out.\n *\n * Note: this setting may switch the AVAudioSession mode to \"voiceChat\" and lower the volume of speaker playback\n *\n * (This option will place both input and output nodes in voice processing mode as noted in Apple docs: http://developer.apple.com/videos/play/wwdc2019/510/?time=66)\n */\n iosVoiceProcessingEnabled?: boolean;\n};\n\nexport type IOSTaskHintValue = (typeof TaskHintIOS)[keyof typeof TaskHintIOS];\n\nexport type RecordingOptions = {\n /**\n * Whether to persist the audio to a local file path.\n *\n * Default: false\n */\n persist: boolean;\n /**\n * Default: `FileSystem.CacheDirectory`. This changes the default storage location for the audio file.\n */\n outputDirectory?: string;\n /**\n * Default: `\"recording_${timestamp|uuid}.[wav|caf]\"`. This changes the file name for the audio file.\n */\n outputFileName?: string;\n /**\n * Default: undefined. The sample rate of the output audio file.\n *\n * Only supported on iOS\n *\n * Default sample rate is: 16000 on Android, 44100/48000 on iOS\n */\n outputSampleRate?: number;\n /**\n * Default: undefined. The encoding of the output audio file.\n *\n * Only supported on iOS\n */\n outputEncoding?:\n | \"pcmFormatFloat32\"\n | \"pcmFormatFloat64\"\n | \"pcmFormatInt16\"\n | \"pcmFormatInt32\";\n};\n\nexport type AudioSourceOptions = {\n /**\n * Local audio source URI.\n *\n * e.g. `\"file:///storage/emulated/0/Download/audio.wav\"`\n */\n uri: string;\n /**\n * [Android only] The number of channels in the source audio.\n *\n * Default: 1\n */\n audioChannels?: number;\n /**\n * [Android only] A value from [AudioFormat](https://developer.android.com/reference/android/media/AudioFormat).\n *\n * Use the `AudioEncodingAndroid` enum to get the correct value.\n */\n audioEncoding?: AudioEncodingAndroidValue;\n /**\n * [Android only] Audio sampling rate in Hz.\n *\n * Default: 16000\n */\n sampleRate?: number;\n /**\n * [Android only] The delay for a 4KiB chunk of audio to stream to the speech recognition service.\n *\n * Use this setting to avoid being rate-limited when using network-based recognition.\n *\n * If you're using on-device recognition, you may want to increase this value to avoid unprocessed audio chunks.\n *\n * Default: 50ms for network-based recognition, 15ms for on-device recognition\n */\n chunkDelayMillis?: number;\n};\n\nexport type AudioEncodingAndroidValue =\n (typeof AudioEncodingAndroid)[keyof typeof AudioEncodingAndroid];\n\nexport type AndroidIntentOptions = {\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_CALLING_PACKAGE\n *\n * The extra key used in an intent to the speech recognizer for voice search. Not generally to be used by developers. The system search dialog uses this, for example, to set a calling package for identification by a voice search API. If this extra is set by anyone but the system process, it should be overridden by the voice search implementation.\n */\n EXTRA_CALLING_PACKAGE: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_BIASING_DEVICE_CONTEXT\n *\n * Optional boolean to enable biasing towards device context. The recognizer will use the device context to tune the recognition results.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_ENABLE_BIASING_DEVICE_CONTEXT: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_LANGUAGE_DETECTION\n *\n * Optional boolean indicating whether to enable language detection. When enabled, the recognizer will consistently identify the language of the current spoken utterance and provide that info via RecognitionListener#onLanguageDetection(Bundle).\n */\n EXTRA_ENABLE_LANGUAGE_DETECTION: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_LANGUAGE_SWITCH\n *\n * Optional string to enable automatic switching to the language being spoken with the desired sensitivity level, instead of being restricted to a single language. The corresponding language models must be downloaded to support the switch. Otherwise, the recognizer will report an error on a switch failure. The recognizer provides the switch results via RecognitionListener#onLanguageDetection(Bundle).\n *\n * Since detection is a necessary requirement for the language switching, setting this value implicitly enables EXTRA_ENABLE_LANGUAGE_DETECTION.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_ENABLE_LANGUAGE_SWITCH: (typeof RecognizerIntentEnableLanguageSwitch)[keyof typeof RecognizerIntentEnableLanguageSwitch];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING\n *\n * NOTE: This is also configurable through `addsPunctuation` (which sets `EXTRA_ENABLE_FORMATTING` to \"quality\")\n *\n * [API level 33] Optional string to enable text formatting (e.g. unspoken punctuation (examples: question mark, comma, period, etc.), capitalization, etc.) and specify the optimization strategy. If set, the partial and final result texts will be formatted. Each result list will contain two hypotheses in the order of 1) formatted text 2) raw text.\n *\n */\n EXTRA_ENABLE_FORMATTING: \"latency\" | \"quality\";\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION\n *\n * [API level 33] Optional boolean, to be used with EXTRA_ENABLE_FORMATTING, to prevent the recognizer adding punctuation after the last word of the partial results. The default is false.\n */\n EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION: boolean;\n /**\n * Optional list of IETF language tags (as defined by BCP 47, e.g. \"en-US\", \"de-DE\").\n *\n * [API level 34] This extra is to be used with EXTRA_ENABLE_LANGUAGE_DETECTION. If set, the recognizer will constrain the language detection output to this list of languages, potentially improving detection accuracy.\n */\n EXTRA_LANGUAGE_DETECTION_ALLOWED_LANGUAGES: string[];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_MODEL\n *\n * [Default: free_form] The language model to use for speech recognition.\n *\n * Informs the recognizer which speech model to prefer when performing ACTION_RECOGNIZE_SPEECH.\n * The recognizer uses this information to fine tune the results.\n * This extra is required. Activities implementing ACTION_RECOGNIZE_SPEECH may interpret the values as they see fit.\n */\n EXTRA_LANGUAGE_MODEL: (typeof RecognizerIntentExtraLanguageModel)[keyof typeof RecognizerIntentExtraLanguageModel];\n\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES\n *\n * [API level 34] Optional list of IETF language tags (as defined by BCP 47, e.g. \"en-US\", \"de-DE\").\n * This extra is to be used with EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the recognizer will apply the auto switch only to these languages, even if the speech models of other languages also exist.\n * The corresponding language models must be downloaded to support the switch. Otherwise, the recognizer will report an error on a switch failure.\n */\n EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES: string[];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS\n *\n * [API level 35] Optional integer to use for EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the language switch will only be activated for this value of ms of audio since the START_OF_SPEECH. This could provide a more stable recognition result when the language switch is only required in the beginning of the session.\n */\n EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES\n *\n * [API level 35] Optional integer to use for EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the language switch will be deactivated when LANGUAGE_SWITCH_MAX_SWITCHES reached.\n *\n * Depending on the recognizer implementation, this flag may have no effect.\n */\n EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_MASK_OFFENSIVE_WORDS\n *\n * [API level 33] Optional boolean indicating whether the recognizer should mask the offensive words in recognition results. The Default is true.\n *\n * Constant Value: \"android.speech.extra.MASK_OFFENSIVE_WORDS\"\n */\n EXTRA_MASK_OFFENSIVE_WORDS: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ORIGIN\n *\n * Optional value which can be used to indicate the referer url of a page in which speech was requested. For example, a web browser may choose to provide this for uses of speech on a given page.\n */\n EXTRA_ORIGIN: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_PREFER_OFFLINE\n *\n * Optional boolean, to be used with ACTION_RECOGNIZE_SPEECH, ACTION_VOICE_SEARCH_HANDS_FREE, ACTION_WEB_SEARCH to indicate whether to only use an offline speech recognition engine. The default is false, meaning that either network or offline recognition engines may be used.\n *\n * Depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_PREFER_OFFLINE: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_PROMPT\n *\n * Optional text prompt to show to the user when asking them to speak.\n */\n EXTRA_PROMPT: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_REQUEST_WORD_CONFIDENCE\n *\n * [API level 34] Optional boolean indicating whether the recognizer should return the confidence level of each word in the final recognition results.\n */\n EXTRA_REQUEST_WORD_CONFIDENCE: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_REQUEST_WORD_TIMING\n *\n * [API level 34] Optional boolean indicating whether the recognizer should return the timestamp of each word in the final recognition results.\n */\n EXTRA_REQUEST_WORD_TIMING: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SECURE\n *\n * Optional boolean to indicate that a \"hands free\" voice search was performed while the device was in a secure mode. An example of secure mode is when the device's screen lock is active, and it requires some form of authentication to be unlocked. When the device is securely locked, the voice search activity should either restrict the set of voice actions that are permitted, or require some form of secure authentication before proceeding.\n */\n EXTRA_SECURE: boolean;\n /**\n * Optional string to enable segmented session mode of the specified type,\n * which can be `EXTRA_AUDIO_SOURCE`, `EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS` or `EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS`.\n * When segmented session mode is supported by the recognizer implementation and this extra is set,\n * it will return the recognition results in segments via [RecognitionListener#onSegmentResults(Bundle)](https://developer.android.com/reference/android/speech/RecognitionListener#onSegmentResults(android.os.Bundle))\n * and terminate the session with [RecognitionListener#onEndOfSegmentedSession()](https://developer.android.com/reference/android/speech/RecognitionListener#onEndOfSegmentedSession()).\n *\n * When setting this extra, make sure the extra used as the string value here is also set in the same intent with proper value.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_SEGMENTED_SESSION:\n | \"android.speech.extra.AUDIO_SOURCE\"\n | \"android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS\"\n | \"android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS\";\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS\n *\n * The amount of time that it should take after the recognizer stops hearing speech to consider the input complete hence end the recognition session.\n *\n * Note that it is extremely rare you'd want to specify this value in an intent. Generally, it should be specified only when it is also used as the value for EXTRA_SEGMENTED_SESSION to enable segmented session mode. Note also that certain values may cause undesired or unexpected results - use judiciously!\n *\n * Depending on the recognizer implementation, these values may have no effect.\n *\n */\n EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS\n *\n * Optional integer to indicate the minimum length of the recognition session. The recognizer will not stop recognizing speech before this amount of time.\n *\n * Note that it is extremely rare you'd want to specify this value in an intent. Generally, it should be specified only when it is also used as the value for EXTRA_SEGMENTED_SESSION to enable segmented session mode. Note also that certain values may cause undesired or unexpected results - use judiciously!\n *\n * Depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS\n *\n * The amount of time that it should take after we stop hearing speech to consider the input possibly complete.\n * This is used to prevent the endpointer cutting off during very short mid-speech pauses.\n * Note that it is extremely rare you'd want to specify this value in an intent.\n * If you don't have a very good reason to change these, you should leave them as they are.\n * Note also that certain values may cause undesired or unexpected results - use judiciously!\n * Additionally, depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: number;\n};\n\nexport type ExpoSpeechRecognitionNativeEvents = {\n [K in keyof ExpoSpeechRecognitionNativeEventMap]: (\n event: ExpoSpeechRecognitionNativeEventMap[K],\n ) => void;\n};\n\nexport declare class ExpoSpeechRecognitionModuleType extends NativeModule<ExpoSpeechRecognitionNativeEvents> {\n /**\n * Starts speech recognition.\n */\n start(options: ExpoSpeechRecognitionOptions): void;\n /**\n * Stops speech recognition and attempts to return a final result (through the `result` event).\n */\n stop(): void;\n /**\n * Cancels speech recognition immediately without returning a final result.\n */\n abort(): void;\n /**\n * Presents a dialog to the user to request permissions for using speech recognition and the microphone.\n *\n * For Android, this will request RECORD_AUDIO permission.\n *\n * For iOS, this will request microphone and speech recognition permissions.\n * Once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns the current permission status for speech recognition and the microphone.\n *\n * You may also use `getMicrophonePermissionsAsync` and `getSpeechRecognizerPermissionsAsync` to get the permissions separately.\n */\n getPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns the current permission status for the microphone.\n */\n getMicrophonePermissionsAsync(): Promise<PermissionResponse>;\n /**\n * Presents a dialog to the user to request permissions for using the microphone.\n *\n * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;\n /**\n * Returns the current permission status for speech recognition.\n */\n getSpeechRecognizerPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * [iOS only] Presents a dialog to the user to request permissions for using the speech recognizer.\n * This permission is required when `requiresOnDeviceRecognition` is disabled (i.e. network-based recognition)\n *\n * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestSpeechRecognizerPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns an array of locales supported by the speech recognizer.\n *\n * Not supported on Android 12 and below (API level 31), this will return an empty array of locales.\n *\n * @throws {\"package_not_found\"} If the service package is not found.\n * @throws {\"error_[number]\"} If there was an error retrieving the supported locales.\n */\n getSupportedLocales(options: {\n /**\n * The package name of the speech recognition service to use.\n *\n * e.g. \"com.google.android.as\" or \"com.samsung.android.bixby.agent\"\n *\n * Warning: the service package (such as Bixby) may not be able to return any results.\n */\n androidRecognitionServicePackage?: string;\n }): Promise<{\n /**\n * All supported languages on the device. This includes both installed and supported languages.\n */\n locales: string[];\n /**\n * These languages are installed on to the device for offline use.\n *\n * This will likely be an empty array if the service package is not \"com.google.android.as\"\n */\n installedLocales: string[];\n }>;\n /**\n * [Android only] Returns an array of package names of speech recognition services that are available on the device.\n *\n * List of all available services as bundle identifiers, e.g. [\"com.google.android.as\", \"com.google.android.tts\"]\n */\n getSpeechRecognitionServices(): string[];\n /**\n * [Android only] Returns the default voice recognition service on the device.\n *\n * @returns empty string if no service is found, or not Android\n */\n getDefaultRecognitionService(): {\n /** e.g. \"com.google.android.tts\" or \"com.google.android.googlequicksearchbox\" */\n packageName: string;\n };\n /**\n * [Android only] Returns the default voice recognition service on the device.\n *\n * e.g. \"com.google.android.googlequicksearchbox\" or \"com.samsung.android.bixby.agent\"\n *\n * @returns empty string if no service is found, or not Android\n */\n getAssistantService(): {\n /** e.g. \"com.google.android.googlequicksearchbox\" or \"com.samsung.android.bixby.agent\" */\n packageName: string;\n };\n /**\n * Whether the on-device speech recognition is available on the device.\n */\n supportsOnDeviceRecognition(): boolean;\n /**\n * Whether the recording feature is available on the device.\n *\n * This mostly applies to Android devices, to check if it's greater than Android 13.\n */\n supportsRecording(): boolean;\n /**\n * Whether on-device speech recognition is available.\n *\n * If this method returns false, `start()` will fail and emit an error event with the code `service-not-allowed` or `language-not-supported`.\n */\n isRecognitionAvailable(): boolean;\n\n /**\n * Downloads the offline model for the specified locale.\n * Note: this is only supported on Android 13 and above.\n */\n androidTriggerOfflineModelDownload(options: {\n /** The locale to download the model for, e.g. \"en-US\" */\n locale: string;\n }): Promise<{\n /**\n * On Android 13, the status will be \"opened_dialog\" indicating that the model download dialog was opened.\n * On Android 14+, the status will be \"download_success\" indicating that the model download was successful.\n * On Android 14+, \"download_canceled\" will be returned if the download was canceled by a user interaction.\n */\n status: \"download_success\" | \"opened_dialog\" | \"download_canceled\";\n message: string;\n }>;\n /**\n * [iOS only] For advanced use cases, you may use this function to set the audio session category and mode.\n *\n * See: https://developer.apple.com/documentation/avfaudio/avaudiosession/1771734-setcategory\n */\n setCategoryIOS(options: SetCategoryOptions): void;\n\n /**\n * [iOS only] Returns the current audio session category and options.\n *\n * See:\n * - [AVAudioSession.Category](https://developer.apple.com/documentation/avfaudio/avaudiosession/category)\n * - [AVAudioSession.CategoryOptions](https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions)\n * - [AVAudioSession.Mode](https://developer.apple.com/documentation/avfaudio/avaudiosession/mode)\n */\n getAudioSessionCategoryAndOptionsIOS(): {\n category: AVAudioSessionCategoryValue;\n categoryOptions: AVAudioSessionCategoryOptionsValue[];\n mode: AVAudioSessionModeValue;\n };\n /**\n * [iOS only] Sets the shared audio session active state.\n *\n * Calls the following on iOS: `AVAudioSession.sharedInstance().setActive(value, options)`\n *\n * See: https://developer.apple.com/documentation/avfaudio/avaudiosession/1616627-setactive\n */\n setAudioSessionActiveIOS(\n value: boolean,\n options?: {\n /** [Default: true] Whether to notify other audio sessions when the active state changes. */\n notifyOthersOnDeactivation: boolean;\n },\n ): void;\n /**\n * Returns the current state of the speech recognizer.\n */\n getStateAsync(): Promise<SpeechRecognitionState>;\n}\n\nexport type SetCategoryOptions = {\n category: AVAudioSessionCategoryValue;\n categoryOptions: AVAudioSessionCategoryOptionsValue[];\n mode?: AVAudioSessionModeValue;\n};\n\ntype SpeechRecognitionState =\n | \"inactive\"\n | \"starting\"\n | \"recognizing\"\n | \"stopping\";\n\n/**\n * [iOS only] See: [AVAudioSession.CategoryOptions](https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions)\n *\n * Use the `AVAudioSessionCategoryOptions` enum to get the correct value.\n */\nexport type AVAudioSessionCategoryOptionsValue =\n (typeof AVAudioSessionCategoryOptions)[keyof typeof AVAudioSessionCategoryOptions];\n\n/**\n * [iOS only] See: [AVAudioSession.Mode](https://developer.apple.com/documentation/avfaudio/avaudiosession/mode)\n *\n * Use the `AVAudioSessionMode` enum to get the correct value.\n */\nexport type AVAudioSessionModeValue =\n (typeof AVAudioSessionMode)[keyof typeof AVAudioSessionMode];\n"]}
1
+ {"version":3,"file":"ExpoSpeechRecognitionModule.types.js","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionResponse } from \"expo-modules-core\";\nimport type { NativeModule } from \"expo\";\n\nexport type ExpoSpeechRecognitionPermissionResponse = PermissionResponse & {\n /**\n * Whether the speech recognition is restricted by Content & Privacy Restrictions.\n *\n * This value corresponds to the `restricted` enum of `SFSpeechRecognizer.authorizationStatus()`.\n *\n * This is only available on iOS.\n */\n restricted?: boolean;\n};\n\nimport type {\n AudioEncodingAndroid,\n AVAudioSessionCategory,\n AVAudioSessionCategoryOptions,\n AVAudioSessionMode,\n RecognizerIntentEnableLanguageSwitch,\n RecognizerIntentExtraLanguageModel,\n TaskHintIOS,\n} from \"./constants\";\n\nexport type AVAudioSessionCategoryValue =\n (typeof AVAudioSessionCategory)[keyof typeof AVAudioSessionCategory];\n\nexport type ExpoSpeechRecognitionResult = {\n transcript: string;\n /**\n * Value ranging between between 0.0, 1.0, and -1 (unavailable) indicating transcript confidence.\n */\n confidence: number;\n /**\n * An array of transcription segments that represent the parts of the transcription, as identified by the speech recognizer.\n *\n * Notes for Android:\n *\n * - This is only available for SDK 34+ (Android 14+)\n * - This is only verified to work with the `com.google.android.as` service (using on device speech recognition)\n * - Segments are only available during the final result\n * - The segment parts are split up by words.\n * - The segments are only available for the first transcript\n * - Segment confidences currently return as -1 (unavailable)\n *\n * Notes for iOS:\n *\n * - The confidence value will be 0 on partial results\n */\n segments: ExpoSpeechRecognitionResultSegment[];\n};\n\nexport type ExpoSpeechRecognitionResultSegment = {\n /** The start timestamp of the utterance, e.g. 1000 */\n startTimeMillis: number;\n /** The end timestamp of the utterance, e.g. 1500 */\n endTimeMillis: number;\n /** The text portion of the transcript, e.g. \"Hello world\" */\n segment: string;\n /** Value ranging between between 0.0, 1.0, and -1 (unavailable) indicating the confidence of the specific segment */\n confidence: number;\n};\n\n/** Fired when there's a speech result. The result may be partial or final */\nexport type ExpoSpeechRecognitionResultEvent = {\n isFinal: boolean;\n results: ExpoSpeechRecognitionResult[];\n};\n\nexport type ExpoSpeechRecognitionErrorCode =\n /** The user called `ExpoSpeechRecognitionModule.abort()`. */\n | \"aborted\"\n /** Audio recording error. */\n | \"audio-capture\"\n /** There was an error in the speech recognition grammar or semantic tags, or the chosen grammar format or semantic tag format was unsupported. */\n | \"bad-grammar\"\n /** Locale is not supported by the speech recognizer. */\n | \"language-not-supported\"\n /** Network communication required for completing the recognition failed. */\n | \"network\"\n /** No final speech was detected. */\n | \"no-speech\"\n /** Permission to use speech recognition or microphone was not granted. */\n | \"not-allowed\"\n /** Recognizer is unavailable. */\n | \"service-not-allowed\"\n // Extra codes (not part of the spec)\n /** The recognizer is busy and cannot accept any new recognition requests. */\n | \"busy\"\n /** (Android only) An unknown client-side error occurred. */\n | \"client\"\n /** (Android) No speech input. */\n | \"speech-timeout\"\n /** (Android) Unknown error */\n | \"unknown\";\n\nexport type ExpoSpeechRecognitionErrorEvent = {\n error: ExpoSpeechRecognitionErrorCode;\n message: string;\n /**\n * The underlying native error code from the platform-specific speech recognition service.\n *\n * - On Android: Maps to SpeechRecognizer error constants (e.g., ERROR_AUDIO = 3)\n * - Value of -1 indicates a generic/unknown error or when native code is not available\n *\n * Usually you won't need this field, but it can be useful for debugging purposes.\n */\n code?: number;\n};\n\nexport type LanguageDetectionEvent = {\n /** The language that was detected, in BCP-47 format. e.g. \"en-US\", \"de-DE\" */\n detectedLanguage: string;\n /** The confidence of the detected language. A value ranging between 0.0 and 1.0.\n *\n * Values range from:\n *\n * - 1.0 (highly confident)\n * - 0.8 (confident)\n * - 0.5 (not confident)\n * - 0.0 (unknown)\n */\n confidence: number;\n /** The alternative locales for the same language, in BCP-47 format. e.g. [\"en-US\", \"en-GB\"] */\n topLocaleAlternatives: string[];\n};\n\n/**\n * Events that are dispatched from the native side\n */\nexport type ExpoSpeechRecognitionNativeEventMap = {\n result: ExpoSpeechRecognitionResultEvent;\n error: ExpoSpeechRecognitionErrorEvent;\n start: null;\n speechstart: null;\n speechend: null;\n /** A final result is returned with no significant recognition */\n nomatch: null;\n /** Audio capturing had started */\n audiostart: {\n /**\n * The uri is set when `recordingOptions.persist` is enabled.\n * Do not attempt to use this file until the `audioend` event is emitted.\n *\n * Example URIs:\n *\n * - Android: `file:///data/user/0/expo.modules.speechrecognition.example/cache/recording_1720678500903.wav`\n * - iOS: `file:///path/to/Library/Caches/audio_CD5E6C6C-3D9D-4754-9188-D6FAF97D9DF2.wav`\n */\n uri: string | null;\n };\n /** Audio capturing had ended */\n audioend: {\n /**\n * The uri is set when `recordingOptions.persist` is enabled.\n *\n * Example URIs:\n *\n * - Android: `file:///data/user/0/expo.modules.speechrecognition.example/cache/recording_1720678500903.wav`\n * - iOS: `file:///path/to/Library/Caches/audio_CD5E6C6C-3D9D-4754-9188-D6FAF97D9DF2.wav`\n */\n uri: string | null;\n };\n end: null;\n soundstart: null;\n soundend: null;\n languagedetection: LanguageDetectionEvent;\n volumechange: {\n /**\n * A float value between -2 and 10 indicating the volume of the input audio\n *\n * Consider anything below 0 to be inaudible\n */\n value: number;\n };\n};\n\nexport type ExpoSpeechRecognitionOptions = {\n /** [Default: \"en-US\"] The language of the speech recognition */\n lang?: string;\n /** [Default: false] Note for iOS: final results are only available after speech recognition has stopped */\n interimResults?: boolean;\n /** [Default: 5] The maximum number of alternative transcriptions to return. */\n maxAlternatives?: number;\n /**\n * An array of strings that will be used to provide context to the speech recognition engine.\n *\n * On Android, this configures [`EXTRA_BIASING_STRINGS`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_BIASING_STRINGS) in the recognizer intent (API level 33+).\n *\n * On iOS, this configures [`SFSpeechRecognitionRequest.contextualStrings`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/1649391-contextualstrings).\n */\n contextualStrings?: string[];\n /**\n * [Default: false] Continuous recognition.\n *\n * Not supported on Android 12 and below.\n *\n * If false, the behaviors are the following:\n *\n * - on iOS 17-, recognition will run until no speech is detected for 3 seconds.\n * - on iOS 18+ and Android, recognition will run until a result with `isFinal: true` is received.\n */\n continuous?: boolean;\n /** [Default: false] Prevent device from sending audio over the network. Only enabled if the device supports it.\n *\n * Use `getSupportedLocales()` to verify if the locale is installed on the device prior to enabling this option.\n */\n requiresOnDeviceRecognition?: boolean;\n /**\n * [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.\n *\n * On Android, this configures [`EXTRA_ENABLE_FORMATTING`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING) in the recognizer intent (Android 13+, API level 33+).\n *\n * Note for Android: This feature is only verified to work on Android 13+ with on-device speech recognition enabled (i.e. enabling `requiresOnDeviceRecognition` or using the `com.google.android.as` service package)\n *\n * On iOS, this configures [`SFSpeechRecognitionRequest.addsPunctuation`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/3930023-addspunctuation).\n */\n addsPunctuation?: boolean;\n /**\n * The package name of the speech recognition service to use.\n * If not provided, the default service will be used.\n *\n * Obtain the supported packages by running `ExpoSpeechRecognitionModule.getSpeechRecognitionServices()`\n *\n * e.g. \"com.google.android.as\" or \"com.samsung.android.bixby.agent\"\n */\n androidRecognitionServicePackage?: string;\n /**\n * Extra options to provide to the Android Recognition intent.\n *\n * For a full list of options, see https://developer.android.com/reference/android/speech/RecognizerIntent\n */\n androidIntentOptions?: Partial<AndroidIntentOptions>;\n /**\n * Audio source options to pass to the recognizer.\n *\n * This option can be used to recognize audio from a local or remote file URI.\n */\n audioSource?: AudioSourceOptions;\n /**\n * Audio recording options for persisting the audio to a local file path.\n */\n recordingOptions?: RecordingOptions;\n /**\n * Default: `\"android.speech.action.RECOGNIZE_SPEECH\"`\n *\n * The kind of intent action\n *\n * Intents:\n *\n * - [`android.speech.action.RECOGNIZE_SPEECH`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_RECOGNIZE_SPEECH) which performs speech recognition (default)\n * - [`android.speech.action.VOICE_SEARCH_HANDS_FREE`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_VOICE_SEARCH_HANDS_FREE) - prompts the user for speech without requiring the user's visual attention or touch input\n * - [`android.speech.action.WEB_SEARCH`](https://developer.android.com/reference/android/speech/RecognizerIntent#ACTION_WEB_SEARCH) - displays a web search result or trigger another type of action based on the user's speech.\n */\n androidIntent?:\n | \"android.speech.action.RECOGNIZE_SPEECH\"\n | \"android.speech.action.VOICE_SEARCH_HANDS_FREE\"\n | \"android.speech.action.WEB_SEARCH\";\n\n /**\n * The hint for the speech recognition task.\n *\n * Default: `\"unspecified\"`\n *\n * Docs: https://developer.apple.com/documentation/speech/sfspeechrecognitiontaskhint\n */\n iosTaskHint?: IOSTaskHintValue;\n\n /**\n * The audio category for the speech recognition task.\n *\n * Use this option to configure the default audio session category and mode prior to starting speech recognition.\n *\n * **Caution:** confirm that the category, options and mode are compatible with the audio source.\n *\n * By default, the audio session category and mode are set to:\n *\n * - category: `playAndRecord`\n * - options: `defaultToSpeaker` and `allowBluetooth`\n * - mode: `measurement`\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category\n */\n iosCategory?: SetCategoryOptions;\n\n /**\n * Settings for volume change events.\n */\n volumeChangeEventOptions?: {\n /**\n * Whether to emit volume change events.\n *\n * Default: false\n */\n enabled?: boolean;\n /**\n * Specifies the interval (in milliseconds) to emit `volumechange` events.\n *\n * Default: 100ms on iOS\n *\n * Increasing this value will improve performance\n */\n intervalMillis?: number;\n };\n\n /**\n * [iOS only] Enabling this option will prevent microphone feedback.\n *\n * When enabled, extra signal processing is applied on the incoming audio, and any audio that is coming from the device is taken out.\n *\n * Note: this setting may switch the AVAudioSession mode to \"voiceChat\" and lower the volume of speaker playback\n *\n * (This option will place both input and output nodes in voice processing mode as noted in Apple docs: http://developer.apple.com/videos/play/wwdc2019/510/?time=66)\n */\n iosVoiceProcessingEnabled?: boolean;\n};\n\nexport type IOSTaskHintValue = (typeof TaskHintIOS)[keyof typeof TaskHintIOS];\n\nexport type RecordingOptions = {\n /**\n * Whether to persist the audio to a local file path.\n *\n * Default: false\n */\n persist: boolean;\n /**\n * Default: `FileSystem.CacheDirectory`. This changes the default storage location for the audio file.\n */\n outputDirectory?: string;\n /**\n * Default: `\"recording_${timestamp|uuid}.[wav|caf]\"`. This changes the file name for the audio file.\n */\n outputFileName?: string;\n /**\n * Default: undefined. The sample rate of the output audio file.\n *\n * Only supported on iOS\n *\n * Default sample rate is: 16000 on Android, 44100/48000 on iOS\n */\n outputSampleRate?: number;\n /**\n * Default: undefined. The encoding of the output audio file.\n *\n * Only supported on iOS\n */\n outputEncoding?:\n | \"pcmFormatFloat32\"\n | \"pcmFormatFloat64\"\n | \"pcmFormatInt16\"\n | \"pcmFormatInt32\";\n};\n\nexport type AudioSourceOptions = {\n /**\n * Local audio source URI.\n *\n * e.g. `\"file:///storage/emulated/0/Download/audio.wav\"`\n */\n uri: string;\n /**\n * [Android only] The number of channels in the source audio.\n *\n * Default: 1\n */\n audioChannels?: number;\n /**\n * [Android only] A value from [AudioFormat](https://developer.android.com/reference/android/media/AudioFormat).\n *\n * Use the `AudioEncodingAndroid` enum to get the correct value.\n */\n audioEncoding?: AudioEncodingAndroidValue;\n /**\n * [Android only] Audio sampling rate in Hz.\n *\n * Default: 16000\n */\n sampleRate?: number;\n /**\n * [Android only] The delay for a 4KiB chunk of audio to stream to the speech recognition service.\n *\n * Use this setting to avoid being rate-limited when using network-based recognition.\n *\n * If you're using on-device recognition, you may want to increase this value to avoid unprocessed audio chunks.\n *\n * Default: 50ms for network-based recognition, 15ms for on-device recognition\n */\n chunkDelayMillis?: number;\n};\n\nexport type AudioEncodingAndroidValue =\n (typeof AudioEncodingAndroid)[keyof typeof AudioEncodingAndroid];\n\nexport type AndroidIntentOptions = {\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_CALLING_PACKAGE\n *\n * The extra key used in an intent to the speech recognizer for voice search. Not generally to be used by developers. The system search dialog uses this, for example, to set a calling package for identification by a voice search API. If this extra is set by anyone but the system process, it should be overridden by the voice search implementation.\n */\n EXTRA_CALLING_PACKAGE: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_BIASING_DEVICE_CONTEXT\n *\n * Optional boolean to enable biasing towards device context. The recognizer will use the device context to tune the recognition results.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_ENABLE_BIASING_DEVICE_CONTEXT: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_LANGUAGE_DETECTION\n *\n * Optional boolean indicating whether to enable language detection. When enabled, the recognizer will consistently identify the language of the current spoken utterance and provide that info via RecognitionListener#onLanguageDetection(Bundle).\n */\n EXTRA_ENABLE_LANGUAGE_DETECTION: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_LANGUAGE_SWITCH\n *\n * Optional string to enable automatic switching to the language being spoken with the desired sensitivity level, instead of being restricted to a single language. The corresponding language models must be downloaded to support the switch. Otherwise, the recognizer will report an error on a switch failure. The recognizer provides the switch results via RecognitionListener#onLanguageDetection(Bundle).\n *\n * Since detection is a necessary requirement for the language switching, setting this value implicitly enables EXTRA_ENABLE_LANGUAGE_DETECTION.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_ENABLE_LANGUAGE_SWITCH: (typeof RecognizerIntentEnableLanguageSwitch)[keyof typeof RecognizerIntentEnableLanguageSwitch];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING\n *\n * NOTE: This is also configurable through `addsPunctuation` (which sets `EXTRA_ENABLE_FORMATTING` to \"quality\")\n *\n * [API level 33] Optional string to enable text formatting (e.g. unspoken punctuation (examples: question mark, comma, period, etc.), capitalization, etc.) and specify the optimization strategy. If set, the partial and final result texts will be formatted. Each result list will contain two hypotheses in the order of 1) formatted text 2) raw text.\n *\n */\n EXTRA_ENABLE_FORMATTING: \"latency\" | \"quality\";\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION\n *\n * [API level 33] Optional boolean, to be used with EXTRA_ENABLE_FORMATTING, to prevent the recognizer adding punctuation after the last word of the partial results. The default is false.\n */\n EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION: boolean;\n /**\n * Optional list of IETF language tags (as defined by BCP 47, e.g. \"en-US\", \"de-DE\").\n *\n * [API level 34] This extra is to be used with EXTRA_ENABLE_LANGUAGE_DETECTION. If set, the recognizer will constrain the language detection output to this list of languages, potentially improving detection accuracy.\n */\n EXTRA_LANGUAGE_DETECTION_ALLOWED_LANGUAGES: string[];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_MODEL\n *\n * [Default: free_form] The language model to use for speech recognition.\n *\n * Informs the recognizer which speech model to prefer when performing ACTION_RECOGNIZE_SPEECH.\n * The recognizer uses this information to fine tune the results.\n * This extra is required. Activities implementing ACTION_RECOGNIZE_SPEECH may interpret the values as they see fit.\n */\n EXTRA_LANGUAGE_MODEL: (typeof RecognizerIntentExtraLanguageModel)[keyof typeof RecognizerIntentExtraLanguageModel];\n\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES\n *\n * [API level 34] Optional list of IETF language tags (as defined by BCP 47, e.g. \"en-US\", \"de-DE\").\n * This extra is to be used with EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the recognizer will apply the auto switch only to these languages, even if the speech models of other languages also exist.\n * The corresponding language models must be downloaded to support the switch. Otherwise, the recognizer will report an error on a switch failure.\n */\n EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES: string[];\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS\n *\n * [API level 35] Optional integer to use for EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the language switch will only be activated for this value of ms of audio since the START_OF_SPEECH. This could provide a more stable recognition result when the language switch is only required in the beginning of the session.\n */\n EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES\n *\n * [API level 35] Optional integer to use for EXTRA_ENABLE_LANGUAGE_SWITCH. If set, the language switch will be deactivated when LANGUAGE_SWITCH_MAX_SWITCHES reached.\n *\n * Depending on the recognizer implementation, this flag may have no effect.\n */\n EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_MASK_OFFENSIVE_WORDS\n *\n * [API level 33] Optional boolean indicating whether the recognizer should mask the offensive words in recognition results. The Default is true.\n *\n * Constant Value: \"android.speech.extra.MASK_OFFENSIVE_WORDS\"\n */\n EXTRA_MASK_OFFENSIVE_WORDS: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ORIGIN\n *\n * Optional value which can be used to indicate the referer url of a page in which speech was requested. For example, a web browser may choose to provide this for uses of speech on a given page.\n */\n EXTRA_ORIGIN: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_PREFER_OFFLINE\n *\n * Optional boolean, to be used with ACTION_RECOGNIZE_SPEECH, ACTION_VOICE_SEARCH_HANDS_FREE, ACTION_WEB_SEARCH to indicate whether to only use an offline speech recognition engine. The default is false, meaning that either network or offline recognition engines may be used.\n *\n * Depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_PREFER_OFFLINE: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_PROMPT\n *\n * Optional text prompt to show to the user when asking them to speak.\n */\n EXTRA_PROMPT: string;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_REQUEST_WORD_CONFIDENCE\n *\n * [API level 34] Optional boolean indicating whether the recognizer should return the confidence level of each word in the final recognition results.\n */\n EXTRA_REQUEST_WORD_CONFIDENCE: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_REQUEST_WORD_TIMING\n *\n * [API level 34] Optional boolean indicating whether the recognizer should return the timestamp of each word in the final recognition results.\n */\n EXTRA_REQUEST_WORD_TIMING: boolean;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SECURE\n *\n * Optional boolean to indicate that a \"hands free\" voice search was performed while the device was in a secure mode. An example of secure mode is when the device's screen lock is active, and it requires some form of authentication to be unlocked. When the device is securely locked, the voice search activity should either restrict the set of voice actions that are permitted, or require some form of secure authentication before proceeding.\n */\n EXTRA_SECURE: boolean;\n /**\n * Optional string to enable segmented session mode of the specified type,\n * which can be `EXTRA_AUDIO_SOURCE`, `EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS` or `EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS`.\n * When segmented session mode is supported by the recognizer implementation and this extra is set,\n * it will return the recognition results in segments via [RecognitionListener#onSegmentResults(Bundle)](https://developer.android.com/reference/android/speech/RecognitionListener#onSegmentResults(android.os.Bundle))\n * and terminate the session with [RecognitionListener#onEndOfSegmentedSession()](https://developer.android.com/reference/android/speech/RecognitionListener#onEndOfSegmentedSession()).\n *\n * When setting this extra, make sure the extra used as the string value here is also set in the same intent with proper value.\n *\n * Depending on the recognizer implementation, this value may have no effect.\n */\n EXTRA_SEGMENTED_SESSION:\n | \"android.speech.extra.AUDIO_SOURCE\"\n | \"android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS\"\n | \"android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS\";\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS\n *\n * The amount of time that it should take after the recognizer stops hearing speech to consider the input complete hence end the recognition session.\n *\n * Note that it is extremely rare you'd want to specify this value in an intent. Generally, it should be specified only when it is also used as the value for EXTRA_SEGMENTED_SESSION to enable segmented session mode. Note also that certain values may cause undesired or unexpected results - use judiciously!\n *\n * Depending on the recognizer implementation, these values may have no effect.\n *\n */\n EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS\n *\n * Optional integer to indicate the minimum length of the recognition session. The recognizer will not stop recognizing speech before this amount of time.\n *\n * Note that it is extremely rare you'd want to specify this value in an intent. Generally, it should be specified only when it is also used as the value for EXTRA_SEGMENTED_SESSION to enable segmented session mode. Note also that certain values may cause undesired or unexpected results - use judiciously!\n *\n * Depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: number;\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS\n *\n * The amount of time that it should take after we stop hearing speech to consider the input possibly complete.\n * This is used to prevent the endpointer cutting off during very short mid-speech pauses.\n * Note that it is extremely rare you'd want to specify this value in an intent.\n * If you don't have a very good reason to change these, you should leave them as they are.\n * Note also that certain values may cause undesired or unexpected results - use judiciously!\n * Additionally, depending on the recognizer implementation, these values may have no effect.\n */\n EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: number;\n};\n\nexport type ExpoSpeechRecognitionNativeEvents = {\n [K in keyof ExpoSpeechRecognitionNativeEventMap]: (\n event: ExpoSpeechRecognitionNativeEventMap[K],\n ) => void;\n};\n\nexport declare class ExpoSpeechRecognitionModuleType extends NativeModule<ExpoSpeechRecognitionNativeEvents> {\n /**\n * Starts speech recognition.\n */\n start(options: ExpoSpeechRecognitionOptions): void;\n /**\n * Stops speech recognition and attempts to return a final result (through the `result` event).\n */\n stop(): void;\n /**\n * Cancels speech recognition immediately without returning a final result.\n */\n abort(): void;\n /**\n * Presents a dialog to the user to request permissions for using speech recognition and the microphone.\n *\n * For Android, this will request RECORD_AUDIO permission.\n *\n * For iOS, this will request microphone and speech recognition permissions.\n * Once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns the current permission status for speech recognition and the microphone.\n *\n * You may also use `getMicrophonePermissionsAsync` and `getSpeechRecognizerPermissionsAsync` to get the permissions separately.\n */\n getPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns the current permission status for the microphone.\n */\n getMicrophonePermissionsAsync(): Promise<PermissionResponse>;\n /**\n * Presents a dialog to the user to request permissions for using the microphone.\n *\n * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;\n /**\n * Returns the current permission status for speech recognition.\n */\n getSpeechRecognizerPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * [iOS only] Presents a dialog to the user to request permissions for using the speech recognizer.\n * This permission is required when `requiresOnDeviceRecognition` is disabled (i.e. network-based recognition)\n *\n * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,\n * the only way that the permissions can be changed is by the user themselves using the device settings app.\n */\n requestSpeechRecognizerPermissionsAsync(): Promise<ExpoSpeechRecognitionPermissionResponse>;\n /**\n * Returns an array of locales supported by the speech recognizer.\n *\n * Not supported on Android 12 and below (API level 31), this will return an empty array of locales.\n *\n * @throws {\"package_not_found\"} If the service package is not found.\n * @throws {\"error_[number]\"} If there was an error retrieving the supported locales.\n */\n getSupportedLocales(options: {\n /**\n * The package name of the speech recognition service to use.\n *\n * e.g. \"com.google.android.as\" or \"com.samsung.android.bixby.agent\"\n *\n * Warning: the service package (such as Bixby) may not be able to return any results.\n */\n androidRecognitionServicePackage?: string;\n }): Promise<{\n /**\n * All supported languages on the device. This includes both installed and supported languages.\n */\n locales: string[];\n /**\n * These languages are installed on to the device for offline use.\n *\n * This will likely be an empty array if the service package is not \"com.google.android.as\"\n */\n installedLocales: string[];\n }>;\n /**\n * [Android only] Returns an array of package names of speech recognition services that are available on the device.\n *\n * List of all available services as bundle identifiers, e.g. [\"com.google.android.as\", \"com.google.android.tts\"]\n */\n getSpeechRecognitionServices(): string[];\n /**\n * [Android only] Returns the default voice recognition service on the device.\n *\n * @returns empty string if no service is found, or not Android\n */\n getDefaultRecognitionService(): {\n /** e.g. \"com.google.android.tts\" or \"com.google.android.googlequicksearchbox\" */\n packageName: string;\n };\n /**\n * [Android only] Returns the default voice recognition service on the device.\n *\n * e.g. \"com.google.android.googlequicksearchbox\" or \"com.samsung.android.bixby.agent\"\n *\n * @returns empty string if no service is found, or not Android\n */\n getAssistantService(): {\n /** e.g. \"com.google.android.googlequicksearchbox\" or \"com.samsung.android.bixby.agent\" */\n packageName: string;\n };\n /**\n * Whether the on-device speech recognition is available on the device.\n */\n supportsOnDeviceRecognition(): boolean;\n /**\n * Whether the recording feature is available on the device.\n *\n * This mostly applies to Android devices, to check if it's greater than Android 13.\n */\n supportsRecording(): boolean;\n /**\n * Whether on-device speech recognition is available.\n *\n * If this method returns false, `start()` will fail and emit an error event with the code `service-not-allowed` or `language-not-supported`.\n */\n isRecognitionAvailable(): boolean;\n\n /**\n * Downloads the offline model for the specified locale.\n * Note: this is only supported on Android 13 and above.\n */\n androidTriggerOfflineModelDownload(options: {\n /** The locale to download the model for, e.g. \"en-US\" */\n locale: string;\n }): Promise<{\n /**\n * On Android 13, the status will be \"opened_dialog\" indicating that the model download dialog was opened.\n * On Android 14+, the status will be \"download_success\" indicating that the model download was successful.\n * On Android 14+, \"download_canceled\" will be returned if the download was canceled by a user interaction.\n */\n status: \"download_success\" | \"opened_dialog\" | \"download_canceled\";\n message: string;\n }>;\n /**\n * [iOS only] For advanced use cases, you may use this function to set the audio session category and mode.\n *\n * See: https://developer.apple.com/documentation/avfaudio/avaudiosession/1771734-setcategory\n */\n setCategoryIOS(options: SetCategoryOptions): void;\n\n /**\n * [iOS only] Returns the current audio session category and options.\n *\n * See:\n * - [AVAudioSession.Category](https://developer.apple.com/documentation/avfaudio/avaudiosession/category)\n * - [AVAudioSession.CategoryOptions](https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions)\n * - [AVAudioSession.Mode](https://developer.apple.com/documentation/avfaudio/avaudiosession/mode)\n */\n getAudioSessionCategoryAndOptionsIOS(): {\n category: AVAudioSessionCategoryValue;\n categoryOptions: AVAudioSessionCategoryOptionsValue[];\n mode: AVAudioSessionModeValue;\n };\n /**\n * [iOS only] Sets the shared audio session active state.\n *\n * Calls the following on iOS: `AVAudioSession.sharedInstance().setActive(value, options)`\n *\n * See: https://developer.apple.com/documentation/avfaudio/avaudiosession/1616627-setactive\n */\n setAudioSessionActiveIOS(\n value: boolean,\n options?: {\n /** [Default: true] Whether to notify other audio sessions when the active state changes. */\n notifyOthersOnDeactivation: boolean;\n },\n ): void;\n /**\n * Returns the current state of the speech recognizer.\n */\n getStateAsync(): Promise<SpeechRecognitionState>;\n}\n\nexport type SetCategoryOptions = {\n category: AVAudioSessionCategoryValue;\n categoryOptions: AVAudioSessionCategoryOptionsValue[];\n mode?: AVAudioSessionModeValue;\n};\n\ntype SpeechRecognitionState =\n | \"inactive\"\n | \"starting\"\n | \"recognizing\"\n | \"stopping\";\n\n/**\n * [iOS only] See: [AVAudioSession.CategoryOptions](https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions)\n *\n * Use the `AVAudioSessionCategoryOptions` enum to get the correct value.\n */\nexport type AVAudioSessionCategoryOptionsValue =\n (typeof AVAudioSessionCategoryOptions)[keyof typeof AVAudioSessionCategoryOptions];\n\n/**\n * [iOS only] See: [AVAudioSession.Mode](https://developer.apple.com/documentation/avfaudio/avaudiosession/mode)\n *\n * Use the `AVAudioSessionMode` enum to get the correct value.\n */\nexport type AVAudioSessionModeValue =\n (typeof AVAudioSessionMode)[keyof typeof AVAudioSessionMode];\n"]}
@@ -341,4 +341,41 @@ export declare const TaskHintIOS: {
341
341
  */
342
342
  readonly confirmation: "confirmation";
343
343
  };
344
+ /**
345
+ * An enum of the error codes for the Android SpeechRecognizer class.
346
+ *
347
+ * Docs: https://developer.android.com/reference/android/speech/SpeechRecognizer
348
+ */
349
+ export declare const SpeechRecognizerErrorAndroid: {
350
+ /** Audio recording error. */
351
+ readonly ERROR_AUDIO: 3;
352
+ /** (API 33+) The service does not allow to check for support. */
353
+ readonly ERROR_CANNOT_CHECK_SUPPORT: 14;
354
+ /** (API 33+) The service does not support listening to model downloads events. */
355
+ readonly ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS: 15;
356
+ /** Other client side errors. */
357
+ readonly ERROR_CLIENT: 5;
358
+ /** Insufficient permissions */
359
+ readonly ERROR_INSUFFICIENT_PERMISSIONS: 9;
360
+ /** Requested language is not available to be used with the current recognizer. */
361
+ readonly ERROR_LANGUAGE_NOT_SUPPORTED: 12;
362
+ /** (API 31+) Requested language is supported, but not available currently (e.g. not downloaded yet). */
363
+ readonly ERROR_LANGUAGE_UNAVAILABLE: 13;
364
+ /** Other network related errors. */
365
+ readonly ERROR_NETWORK: 2;
366
+ /** Network operation timed out. */
367
+ readonly ERROR_NETWORK_TIMEOUT: 1;
368
+ /** No recognition result matched. */
369
+ readonly ERROR_NO_MATCH: 7;
370
+ /** RecognitionService busy. */
371
+ readonly ERROR_RECOGNIZER_BUSY: 8;
372
+ /** Server sends error status. */
373
+ readonly ERROR_SERVER: 4;
374
+ /** Server has been disconnected, e.g. because the app has crashed. */
375
+ readonly ERROR_SERVER_DISCONNECTED: 11;
376
+ /** No speech input */
377
+ readonly ERROR_SPEECH_TIMEOUT: 6;
378
+ /** (API 31+) Too many requests from the same client. */
379
+ readonly ERRO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;;IAEH;;;;OAIG;;CAEK,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;IACvC,6BAA6B;;IAE7B,iEAAiE;;IAEjE,kFAAkF;;IAElF,gCAAgC;;IAEhC,+BAA+B;;IAE/B,kFAAkF;;IAElF,wGAAwG;;IAExG,oCAAoC;;IAEpC,mCAAmC;;IAEnC,qCAAqC;;IAErC,+BAA+B;;IAE/B,iCAAiC;;IAEjC,sEAAsE;;IAEtE,sBAAsB;;IAEtB,wDAAwD;;CAEhD,CAAC"}
@@ -341,4 +341,41 @@ export const TaskHintIOS = {
341
341
  */
342
342
  confirmation: "confirmation",
343
343
  };
344
+ /**
345
+ * An enum of the error codes for the Android SpeechRecognizer class.
346
+ *
347
+ * Docs: https://developer.android.com/reference/android/speech/SpeechRecognizer
348
+ */
349
+ export const SpeechRecognizerErrorAndroid = {
350
+ /** Audio recording error. */
351
+ ERROR_AUDIO: 3,
352
+ /** (API 33+) The service does not allow to check for support. */
353
+ ERROR_CANNOT_CHECK_SUPPORT: 14,
354
+ /** (API 33+) The service does not support listening to model downloads events. */
355
+ ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS: 15,
356
+ /** Other client side errors. */
357
+ ERROR_CLIENT: 5,
358
+ /** Insufficient permissions */
359
+ ERROR_INSUFFICIENT_PERMISSIONS: 9,
360
+ /** Requested language is not available to be used with the current recognizer. */
361
+ ERROR_LANGUAGE_NOT_SUPPORTED: 12,
362
+ /** (API 31+) Requested language is supported, but not available currently (e.g. not downloaded yet). */
363
+ ERROR_LANGUAGE_UNAVAILABLE: 13,
364
+ /** Other network related errors. */
365
+ ERROR_NETWORK: 2,
366
+ /** Network operation timed out. */
367
+ ERROR_NETWORK_TIMEOUT: 1,
368
+ /** No recognition result matched. */
369
+ ERROR_NO_MATCH: 7,
370
+ /** RecognitionService busy. */
371
+ ERROR_RECOGNIZER_BUSY: 8,
372
+ /** Server sends error status. */
373
+ ERROR_SERVER: 4,
374
+ /** Server has been disconnected, e.g. because the app has crashed. */
375
+ ERROR_SERVER_DISCONNECTED: 11,
376
+ /** No speech input */
377
+ ERROR_SPEECH_TIMEOUT: 6,
378
+ /** (API 31+) Too many requests from the same client. */
379
+ ERROR_TOO_MANY_REQUESTS: 10,
380
+ };
344
381
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;;;;;;;;OAQG;IACH,OAAO,EAAE,SAAS;IAClB;;;;;;;;OAQG;IACH,WAAW,EAAE,aAAa;IAC1B;;;;;;;;OAQG;IACH,QAAQ,EAAE,UAAU;IACpB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,QAAQ;IAChB;;;;;;;;;;;;;;OAcG;IACH,aAAa,EAAE,eAAe;IAC9B;;;;;;;;OAQG;IACH,UAAU,EAAE,YAAY;CAChB,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C;;;;OAIG;IACH,aAAa,EAAE,eAAe;IAC9B;;;;OAIG;IACH,UAAU,EAAE,YAAY;IACxB;;;;OAIG;IACH,oCAAoC,EAAE,sCAAsC;IAC5E;;;;OAIG;IACH,cAAc,EAAE,gBAAgB;IAChC;;;;OAIG;IACH,kBAAkB,EAAE,oBAAoB;IACxC;;;;OAIG;IACH,YAAY,EAAE,cAAc;IAC5B;;;;OAIG;IACH,gBAAgB,EAAE,kBAAkB;IACpC;;;;OAIG;IACH,mCAAmC,EAAE,qCAAqC;CAClE,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC;;;;OAIG;IACH,OAAO,EAAE,SAAS;IAClB;;;;;;OAMG;IACH,QAAQ,EAAE,UAAU;IACpB;;;;;;;;OAQG;IACH,WAAW,EAAE,aAAa;IAC1B;;;;;;OAMG;IACH,aAAa,EAAE,eAAe;I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AIG;IACH,YAAY,EAAE,cAAc;CACpB,CAAC","sourcesContent":["/**\n * [iOS] Audio category used for defining the audio behavior\n *\n * Docs: [AVAudioSession.Category](https://developer.apple.com/documentation/avfaudio/avaudiosession/category)\n */\nexport const AVAudioSessionCategory = {\n /**\n * The category for an app in which sound playback is nonprimary — that is, your app also works with the sound turned off.\n *\n * This category is also appropriate for “play-along” apps, such as a virtual piano that a user plays while the Music app is playing.\n * When you use this category, audio from other apps mixes with your audio.\n * Screen locking and the Silent switch (on iPhone, the Ring/Silent switch) silence your audio.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient\n */\n ambient: \"ambient\",\n /**\n * The default audio session category.\n *\n * Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing, use the ambient category instead.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient\n */\n soloAmbient: \"soloAmbient\",\n /**\n * The category for playing recorded music or other sounds that are central to the successful use of your app.\n *\n * When using this category, your app audio continues with the Silent switch set to silent or when the screen locks. (The switch is called the Ring/Silent switch on iPhone.) To continue playing audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing for this category, use the mixWithOthers option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback\n */\n playback: \"playback\",\n /**\n * The category for recording audio while also silencing playback audio.\n *\n * This category has the effect of silencing virtually all output on the system, for as long as the session is active. Unless you need to prevent any unexpected sounds from being played, use playAndRecord instead.\n *\n * To continue recording audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * The user must grant permission for audio recording.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record\n */\n record: \"record\",\n /**\n * The category for recording (input) and playback (output) of audio, such as for a Voice over Internet Protocol (VoIP) app.\n *\n * Your audio continues with the Silent switch set to silent and with the screen locked. (The switch is called the Ring/Silent switch on iPhone.) To continue playing audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * This category is appropriate for simultaneous recording and playback, and also for apps that record and play back, but not simultaneously.\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing for this category, use the mixWithOthers option.\n *\n * The user must grant permission for audio recording.\n *\n * This category supports the mirrored version of AirPlay. However, AirPlay mirroring will be disabled if the AVAudioSessionModeVoiceChat mode is used with this category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord\n */\n playAndRecord: \"playAndRecord\",\n /**\n * The category for routing distinct streams of audio data to different output devices at the same time.\n *\n * This category can be used for input, output, or both. For example, use this category to route audio to\n * both a USB device and a set of headphones. Use of this category requires a more detailed knowledge of,\n * and interaction with, the capabilities of the available audio routes.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute\n */\n multiRoute: \"multiRoute\",\n} as const;\n\n/**\n * Constants that specify optional audio behaviors.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions\n */\nexport const AVAudioSessionCategoryOptions = {\n /**\n * An option that indicates whether audio from this session mixes with audio from active sessions in other audio apps.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers\n */\n mixWithOthers: \"mixWithOthers\",\n /**\n * An option that reduces the volume of other audio sessions while audio from this session plays.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers\n */\n duckOthers: \"duckOthers\",\n /**\n * An option that determines whether to pause spoken audio content from other sessions when your app plays its audio.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot\n */\n interruptSpokenAudioAndMixWithOthers: \"interruptSpokenAudioAndMixWithOthers\",\n /**\n * An option that determines whether Bluetooth hands-free devices appear as available input routes.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth\n */\n allowBluetooth: \"allowBluetooth\",\n /**\n * An option that determines whether you can stream audio from this session to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp\n */\n allowBluetoothA2DP: \"allowBluetoothA2DP\",\n /**\n * An option that determines whether you can stream audio from this session to AirPlay devices.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay\n */\n allowAirPlay: \"allowAirPlay\",\n /**\n * An option that determines whether audio from the session defaults to the built-in speaker instead of the receiver.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/3727255-overridemutedmicrophoneinterrupt\n */\n defaultToSpeaker: \"defaultToSpeaker\",\n /**\n * An option that indicates whether the system interrupts the audio session when it mutes the built-in microphone.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/3727255-overridemutedmicrophoneinterrupt\n */\n overrideMutedMicrophoneInterruption: \"overrideMutedMicrophoneInterruption\",\n} as const;\n\n/**\n * The audio session mode, together with the audio session category, indicates to the system how you intend to use audio in your app. You can use a mode to configure the audio system for specific use cases such as video recording, voice or video chat, or audio analysis.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/1616508-mode\n */\nexport const AVAudioSessionMode = {\n /**\n * The default audio session mode. You can use this mode with every audio session category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default\n */\n default: \"default\",\n /**\n * A mode that the GameKit framework sets on behalf of an application that uses GameKit’s voice chat service. This mode is valid only with the playAndRecord audio session category.\n *\n * Don’t set this mode directly. If you need similar behavior and aren’t using a GKVoiceChat object, use voiceChat or videoChat instead.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat\n */\n gameChat: \"gameChat\",\n /**\n * A mode that indicates that your app is performing measurement of audio input or output.\n *\n * Use this mode for apps that need to minimize the amount of system-supplied signal processing to input and output signals. If recording on devices with more than one built-in microphone, the session uses the primary microphone.\n *\n * Important: This mode disables some dynamics processing on input and output signals, resulting in a lower-output playback level.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement\n */\n measurement: \"measurement\",\n /**\n * A mode that indicates that your app is playing back movie content.\n *\n * When you set this mode, the audio session uses signal processing to enhance movie playback for certain audio routes such as built-in speaker or headphones. You may only use this mode with the `playback` audio session category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback\n */\n moviePlayback: \"moviePlayback\",\n /**\n * A mode used for continuous spoken audio to pause the audio when another app plays a short audio prompt.\n *\n * This mode is appropriate for apps that play continuous spoken audio, such as podcasts or audio books. Setting this mode indicates that your app should pause, rather than duck, its audio if another app plays a spoken audio prompt. After the interrupting app’s audio ends, you can resume your app’s audio playback.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio\n */\n spokenAudio: \"spokenAudio\",\n /**\n * A mode that indicates that your app is engaging in online video conferencing.\n *\n * Use this mode for video chat apps that use the `playAndRecord` or `record` categories. When you set this mode, the audio session optimizes the device’s tonal equalization for voice. It also reduces the set of allowable audio routes to only those appropriate for video chat.\n *\n * Using this mode has the side effect of enabling the `allowBluetooth` category option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat\n */\n videoChat: \"videoChat\",\n /**\n * A mode that indicates that your app is recording a movie.\n *\n * This mode is valid only with the `record` and `playAndRecord` audio session categories. On devices with more than one built-in microphone, the audio session uses the microphone closest to the video camera.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording\n */\n videoRecording: \"videoRecording\",\n /**\n * A mode that indicates that your app is performing two-way voice communication, such as using Voice over Internet Protocol (VoIP).\n *\n * Use this mode for Voice over IP (VoIP) apps that use the `playAndRecord` category. When you set this mode, the session optimizes the device’s tonal equalization for voice and reduces the set of allowable audio routes to only those appropriate for voice chat.\n *\n * Using this mode has the side effect of enabling the `allowBluetooth` category option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat\n */\n voiceChat: \"voiceChat\",\n /**\n * A mode that indicates that your app plays audio using text-to-speech.\n *\n * Setting this mode allows for different routing behaviors when your app connects to certain audio devices, such as CarPlay. An example of an app that uses this mode is a turn-by-turn navigation app that plays short prompts to the user.\n *\n * Typically, apps of the same type also configure their sessions to use the duckOthers and interruptSpokenAudioAndMixWithOthers options.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt\n */\n voicePrompt: \"voicePrompt\",\n} as const;\n\n/**\n * Options for the `EXTRA_LANGUAGE_MODEL` extra.\n *\n * Docs: https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_MODEL\n */\nexport const RecognizerIntentExtraLanguageModel = {\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_MODEL_FREE_FORM\n *\n * Use a language model based on free-form speech recognition. This is a value to use for EXTRA_LANGUAGE_MODEL.\n */\n LANGUAGE_MODEL_FREE_FORM: \"free_form\",\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_MODEL_WEB_SEARCH\n *\n * Use a language model based on web search terms. This is a value to use for EXTRA_LANGUAGE_MODEL.\n */\n LANGUAGE_MODEL_WEB_SEARCH: \"web_search\",\n} as const;\n\n/**\n * Options for the `EXTRA_ENABLE_LANGUAGE_SWITCH` extra.\n *\n * Docs: https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_MODEL\n */\nexport const RecognizerIntentEnableLanguageSwitch = {\n /**\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as at least [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT), which means the service is balancing between detecting a new language confidently and switching early.\n */\n LANGUAGE_SWITCH_BALANCED: \"balanced\",\n /**\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT), which means the service may wait for longer before switching.\n */\n LANGUAGE_SWITCH_HIGH_PRECISION: \"high_precision\",\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_SWITCH_QUICK_RESPONSE\n *\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as at least [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT), which means the service should switch at the earliest moment possible.\n */\n LANGUAGE_SWITCH_QUICK_RESPONSE: \"quick_response\",\n} as const;\n\n/**\n * Android only\n *\n * See: [AudioFormat](https://developer.android.com/reference/android/media/AudioFormat)\n */\nexport const AudioEncodingAndroid = {\n /**\n * Audio data format: MP3 compressed\n */\n ENCODING_MP3: 9,\n /**\n * Audio data format: MPEG-H baseline profile, level 3\n */\n ENCODING_MPEGH_BL_L3: 23,\n /**\n * Audio data format: MPEG-H baseline profile, level 4\n */\n ENCODING_MPEGH_BL_L4: 24,\n /**\n * Audio data format: MPEG-H low complexity profile, level 3\n */\n ENCODING_MPEGH_LC_L3: 25,\n /**\n * Audio data format: MPEG-H low complexity profile, level 4\n */\n ENCODING_MPEGH_LC_L4: 26,\n /**\n * Audio data format: OPUS compressed.\n */\n ENCODING_OPUS: 20,\n /**\n * Audio data format: PCM 16 bit per sample. Guaranteed to be supported by devices.\n */\n ENCODING_PCM_16BIT: 2,\n /**\n * Audio data format: PCM 24 bit per sample packed as 3 bytes. The bytes are in little-endian order, so the least significant byte comes first in the byte array. Not guaranteed to be supported by devices, may be emulated if not supported.\n */\n ENCODING_PCM_24BIT_PACKED: 21,\n /**\n * Audio data format: PCM 32 bit per sample. Not guaranteed to be supported by devices, may be emulated if not supported.\n */\n ENCODING_PCM_32BIT: 22,\n /**\n * Audio data format: PCM 8 bit per sample. Not guaranteed to be supported by devices.\n */\n ENCODING_PCM_8BIT: 3,\n /**\n * Audio data format: single-precision floating-point per sample\n */\n ENCODING_PCM_FLOAT: 4,\n} as const;\n\n/**\n * [iOS Only] The type of task for which you are using speech recognition.\n *\n * Docs: https://developer.apple.com/documentation/speech/sfspeechrecognitiontaskhint\n */\nexport const TaskHintIOS = {\n /**\n * The task hint is unspecified.\n *\n * Use this hint type when the intended use for captured speech does not match the other task types.\n */\n unspecified: \"unspecified\",\n /**\n * A task that uses captured speech for text entry.\n *\n * Use this hint type when you are using speech recognition for a task that's similar to the keyboard's built-in dictation function.\n */\n dictation: \"dictation\",\n /**\n * A task that uses captured speech to specify seach terms.\n *\n * Use this hint type when you are using speech recognition to identify search terms.\n */\n search: \"search\",\n /**\n * A task that uses captured speech for short, confirmation-style requests.\n *\n * Use this hint type when you are using speech recognition to handle confirmation commands, such as \"yes,\" \"no,\" or \"maybe.\"\n */\n confirmation: \"confirmation\",\n} as const;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;;;;;;;;OAQG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AAwG;IACxG,0BAA0B,EAAE,EAAE;IAC9B,oCAAoC;IACpC,aAAa,EAAE,CAAC;IAChB,mCAAmC;IACnC,qBAAqB,EAAE,CAAC;IACxB,qCAAqC;IACrC,cAAc,EAAE,CAAC;IACjB,+BAA+B;IAC/B,qBAAqB,EAAE,CAAC;IACxB,iCAAiC;IACjC,YAAY,EAAE,CAAC;IACf,sEAAsE;IACtE,yBAAyB,EAAE,EAAE;IAC7B,sBAAsB;IACtB,oBAAoB,EAAE,CAAC;IACvB,wDAAwD;IACxD,uBAAuB,EAAE,EAAE;CACnB,CAAC","sourcesContent":["/**\n * [iOS] Audio category used for defining the audio behavior\n *\n * Docs: [AVAudioSession.Category](https://developer.apple.com/documentation/avfaudio/avaudiosession/category)\n */\nexport const AVAudioSessionCategory = {\n /**\n * The category for an app in which sound playback is nonprimary — that is, your app also works with the sound turned off.\n *\n * This category is also appropriate for “play-along” apps, such as a virtual piano that a user plays while the Music app is playing.\n * When you use this category, audio from other apps mixes with your audio.\n * Screen locking and the Silent switch (on iPhone, the Ring/Silent switch) silence your audio.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient\n */\n ambient: \"ambient\",\n /**\n * The default audio session category.\n *\n * Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing, use the ambient category instead.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient\n */\n soloAmbient: \"soloAmbient\",\n /**\n * The category for playing recorded music or other sounds that are central to the successful use of your app.\n *\n * When using this category, your app audio continues with the Silent switch set to silent or when the screen locks. (The switch is called the Ring/Silent switch on iPhone.) To continue playing audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing for this category, use the mixWithOthers option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback\n */\n playback: \"playback\",\n /**\n * The category for recording audio while also silencing playback audio.\n *\n * This category has the effect of silencing virtually all output on the system, for as long as the session is active. Unless you need to prevent any unexpected sounds from being played, use playAndRecord instead.\n *\n * To continue recording audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * The user must grant permission for audio recording.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record\n */\n record: \"record\",\n /**\n * The category for recording (input) and playback (output) of audio, such as for a Voice over Internet Protocol (VoIP) app.\n *\n * Your audio continues with the Silent switch set to silent and with the screen locked. (The switch is called the Ring/Silent switch on iPhone.) To continue playing audio when your app transitions to the background (for example, when the screen locks), add the audio value to the UIBackgroundModes key in your information property list file.\n *\n * This category is appropriate for simultaneous recording and playback, and also for apps that record and play back, but not simultaneously.\n *\n * By default, using this category implies that your app’s audio is nonmixable—activating your session will interrupt any other audio sessions which are also nonmixable. To allow mixing for this category, use the mixWithOthers option.\n *\n * The user must grant permission for audio recording.\n *\n * This category supports the mirrored version of AirPlay. However, AirPlay mirroring will be disabled if the AVAudioSessionModeVoiceChat mode is used with this category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord\n */\n playAndRecord: \"playAndRecord\",\n /**\n * The category for routing distinct streams of audio data to different output devices at the same time.\n *\n * This category can be used for input, output, or both. For example, use this category to route audio to\n * both a USB device and a set of headphones. Use of this category requires a more detailed knowledge of,\n * and interaction with, the capabilities of the available audio routes.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute\n */\n multiRoute: \"multiRoute\",\n} as const;\n\n/**\n * Constants that specify optional audio behaviors.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions\n */\nexport const AVAudioSessionCategoryOptions = {\n /**\n * An option that indicates whether audio from this session mixes with audio from active sessions in other audio apps.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers\n */\n mixWithOthers: \"mixWithOthers\",\n /**\n * An option that reduces the volume of other audio sessions while audio from this session plays.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers\n */\n duckOthers: \"duckOthers\",\n /**\n * An option that determines whether to pause spoken audio content from other sessions when your app plays its audio.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot\n */\n interruptSpokenAudioAndMixWithOthers: \"interruptSpokenAudioAndMixWithOthers\",\n /**\n * An option that determines whether Bluetooth hands-free devices appear as available input routes.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth\n */\n allowBluetooth: \"allowBluetooth\",\n /**\n * An option that determines whether you can stream audio from this session to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp\n */\n allowBluetoothA2DP: \"allowBluetoothA2DP\",\n /**\n * An option that determines whether you can stream audio from this session to AirPlay devices.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay\n */\n allowAirPlay: \"allowAirPlay\",\n /**\n * An option that determines whether audio from the session defaults to the built-in speaker instead of the receiver.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/3727255-overridemutedmicrophoneinterrupt\n */\n defaultToSpeaker: \"defaultToSpeaker\",\n /**\n * An option that indicates whether the system interrupts the audio session when it mutes the built-in microphone.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/3727255-overridemutedmicrophoneinterrupt\n */\n overrideMutedMicrophoneInterruption: \"overrideMutedMicrophoneInterruption\",\n} as const;\n\n/**\n * The audio session mode, together with the audio session category, indicates to the system how you intend to use audio in your app. You can use a mode to configure the audio system for specific use cases such as video recording, voice or video chat, or audio analysis.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/1616508-mode\n */\nexport const AVAudioSessionMode = {\n /**\n * The default audio session mode. You can use this mode with every audio session category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default\n */\n default: \"default\",\n /**\n * A mode that the GameKit framework sets on behalf of an application that uses GameKit’s voice chat service. This mode is valid only with the playAndRecord audio session category.\n *\n * Don’t set this mode directly. If you need similar behavior and aren’t using a GKVoiceChat object, use voiceChat or videoChat instead.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat\n */\n gameChat: \"gameChat\",\n /**\n * A mode that indicates that your app is performing measurement of audio input or output.\n *\n * Use this mode for apps that need to minimize the amount of system-supplied signal processing to input and output signals. If recording on devices with more than one built-in microphone, the session uses the primary microphone.\n *\n * Important: This mode disables some dynamics processing on input and output signals, resulting in a lower-output playback level.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement\n */\n measurement: \"measurement\",\n /**\n * A mode that indicates that your app is playing back movie content.\n *\n * When you set this mode, the audio session uses signal processing to enhance movie playback for certain audio routes such as built-in speaker or headphones. You may only use this mode with the `playback` audio session category.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback\n */\n moviePlayback: \"moviePlayback\",\n /**\n * A mode used for continuous spoken audio to pause the audio when another app plays a short audio prompt.\n *\n * This mode is appropriate for apps that play continuous spoken audio, such as podcasts or audio books. Setting this mode indicates that your app should pause, rather than duck, its audio if another app plays a spoken audio prompt. After the interrupting app’s audio ends, you can resume your app’s audio playback.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio\n */\n spokenAudio: \"spokenAudio\",\n /**\n * A mode that indicates that your app is engaging in online video conferencing.\n *\n * Use this mode for video chat apps that use the `playAndRecord` or `record` categories. When you set this mode, the audio session optimizes the device’s tonal equalization for voice. It also reduces the set of allowable audio routes to only those appropriate for video chat.\n *\n * Using this mode has the side effect of enabling the `allowBluetooth` category option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat\n */\n videoChat: \"videoChat\",\n /**\n * A mode that indicates that your app is recording a movie.\n *\n * This mode is valid only with the `record` and `playAndRecord` audio session categories. On devices with more than one built-in microphone, the audio session uses the microphone closest to the video camera.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording\n */\n videoRecording: \"videoRecording\",\n /**\n * A mode that indicates that your app is performing two-way voice communication, such as using Voice over Internet Protocol (VoIP).\n *\n * Use this mode for Voice over IP (VoIP) apps that use the `playAndRecord` category. When you set this mode, the session optimizes the device’s tonal equalization for voice and reduces the set of allowable audio routes to only those appropriate for voice chat.\n *\n * Using this mode has the side effect of enabling the `allowBluetooth` category option.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat\n */\n voiceChat: \"voiceChat\",\n /**\n * A mode that indicates that your app plays audio using text-to-speech.\n *\n * Setting this mode allows for different routing behaviors when your app connects to certain audio devices, such as CarPlay. An example of an app that uses this mode is a turn-by-turn navigation app that plays short prompts to the user.\n *\n * Typically, apps of the same type also configure their sessions to use the duckOthers and interruptSpokenAudioAndMixWithOthers options.\n *\n * Docs: https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt\n */\n voicePrompt: \"voicePrompt\",\n} as const;\n\n/**\n * Options for the `EXTRA_LANGUAGE_MODEL` extra.\n *\n * Docs: https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_MODEL\n */\nexport const RecognizerIntentExtraLanguageModel = {\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_MODEL_FREE_FORM\n *\n * Use a language model based on free-form speech recognition. This is a value to use for EXTRA_LANGUAGE_MODEL.\n */\n LANGUAGE_MODEL_FREE_FORM: \"free_form\",\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_MODEL_WEB_SEARCH\n *\n * Use a language model based on web search terms. This is a value to use for EXTRA_LANGUAGE_MODEL.\n */\n LANGUAGE_MODEL_WEB_SEARCH: \"web_search\",\n} as const;\n\n/**\n * Options for the `EXTRA_ENABLE_LANGUAGE_SWITCH` extra.\n *\n * Docs: https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_LANGUAGE_SWITCH_MODEL\n */\nexport const RecognizerIntentEnableLanguageSwitch = {\n /**\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as at least [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT), which means the service is balancing between detecting a new language confidently and switching early.\n */\n LANGUAGE_SWITCH_BALANCED: \"balanced\",\n /**\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT), which means the service may wait for longer before switching.\n */\n LANGUAGE_SWITCH_HIGH_PRECISION: \"high_precision\",\n /**\n * https://developer.android.com/reference/android/speech/RecognizerIntent#LANGUAGE_SWITCH_QUICK_RESPONSE\n *\n * A value to use for `EXTRA_ENABLE_LANGUAGE_SWITCH`.\n *\n * Enables language switch only when a new language is detected as at least [SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT](https://developer.android.com/reference/android/speech/SpeechRecognizer#LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT), which means the service should switch at the earliest moment possible.\n */\n LANGUAGE_SWITCH_QUICK_RESPONSE: \"quick_response\",\n} as const;\n\n/**\n * Android only\n *\n * See: [AudioFormat](https://developer.android.com/reference/android/media/AudioFormat)\n */\nexport const AudioEncodingAndroid = {\n /**\n * Audio data format: MP3 compressed\n */\n ENCODING_MP3: 9,\n /**\n * Audio data format: MPEG-H baseline profile, level 3\n */\n ENCODING_MPEGH_BL_L3: 23,\n /**\n * Audio data format: MPEG-H baseline profile, level 4\n */\n ENCODING_MPEGH_BL_L4: 24,\n /**\n * Audio data format: MPEG-H low complexity profile, level 3\n */\n ENCODING_MPEGH_LC_L3: 25,\n /**\n * Audio data format: MPEG-H low complexity profile, level 4\n */\n ENCODING_MPEGH_LC_L4: 26,\n /**\n * Audio data format: OPUS compressed.\n */\n ENCODING_OPUS: 20,\n /**\n * Audio data format: PCM 16 bit per sample. Guaranteed to be supported by devices.\n */\n ENCODING_PCM_16BIT: 2,\n /**\n * Audio data format: PCM 24 bit per sample packed as 3 bytes. The bytes are in little-endian order, so the least significant byte comes first in the byte array. Not guaranteed to be supported by devices, may be emulated if not supported.\n */\n ENCODING_PCM_24BIT_PACKED: 21,\n /**\n * Audio data format: PCM 32 bit per sample. Not guaranteed to be supported by devices, may be emulated if not supported.\n */\n ENCODING_PCM_32BIT: 22,\n /**\n * Audio data format: PCM 8 bit per sample. Not guaranteed to be supported by devices.\n */\n ENCODING_PCM_8BIT: 3,\n /**\n * Audio data format: single-precision floating-point per sample\n */\n ENCODING_PCM_FLOAT: 4,\n} as const;\n\n/**\n * [iOS Only] The type of task for which you are using speech recognition.\n *\n * Docs: https://developer.apple.com/documentation/speech/sfspeechrecognitiontaskhint\n */\nexport const TaskHintIOS = {\n /**\n * The task hint is unspecified.\n *\n * Use this hint type when the intended use for captured speech does not match the other task types.\n */\n unspecified: \"unspecified\",\n /**\n * A task that uses captured speech for text entry.\n *\n * Use this hint type when you are using speech recognition for a task that's similar to the keyboard's built-in dictation function.\n */\n dictation: \"dictation\",\n /**\n * A task that uses captured speech to specify seach terms.\n *\n * Use this hint type when you are using speech recognition to identify search terms.\n */\n search: \"search\",\n /**\n * A task that uses captured speech for short, confirmation-style requests.\n *\n * Use this hint type when you are using speech recognition to handle confirmation commands, such as \"yes,\" \"no,\" or \"maybe.\"\n */\n confirmation: \"confirmation\",\n} as const;\n\n/**\n * An enum of the error codes for the Android SpeechRecognizer class.\n *\n * Docs: https://developer.android.com/reference/android/speech/SpeechRecognizer\n */\nexport const SpeechRecognizerErrorAndroid = {\n /** Audio recording error. */\n ERROR_AUDIO: 3,\n /** (API 33+) The service does not allow to check for support. */\n ERROR_CANNOT_CHECK_SUPPORT: 14,\n /** (API 33+) The service does not support listening to model downloads events. */\n ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS: 15,\n /** Other client side errors. */\n ERROR_CLIENT: 5,\n /** Insufficient permissions */\n ERROR_INSUFFICIENT_PERMISSIONS: 9,\n /** Requested language is not available to be used with the current recognizer. */\n ERROR_LANGUAGE_NOT_SUPPORTED: 12,\n /** (API 31+) Requested language is supported, but not available currently (e.g. not downloaded yet). */\n ERROR_LANGUAGE_UNAVAILABLE: 13,\n /** Other network related errors. */\n ERROR_NETWORK: 2,\n /** Network operation timed out. */\n ERROR_NETWORK_TIMEOUT: 1,\n /** No recognition result matched. */\n ERROR_NO_MATCH: 7,\n /** RecognitionService busy. */\n ERROR_RECOGNIZER_BUSY: 8,\n /** Server sends error status. */\n ERROR_SERVER: 4,\n /** Server has been disconnected, e.g. because the app has crashed. */\n ERROR_SERVER_DISCONNECTED: 11,\n /** No speech input */\n ERROR_SPEECH_TIMEOUT: 6,\n /** (API 31+) Too many requests from the same client. */\n ERROR_TOO_MANY_REQUESTS: 10,\n} as const;\n"]}
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { ExpoWebSpeechRecognition, ExpoWebSpeechGrammar, ExpoWebSpeechGrammarList, } from "./ExpoWebSpeechRecognition";
2
2
  export { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
3
3
  export { useSpeechRecognitionEvent } from "./useSpeechRecognitionEvent";
4
- export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, } from "./constants";
4
+ export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, SpeechRecognizerErrorAndroid, } from "./constants";
5
5
  export declare const getSupportedLocales: (options?: {
6
6
  androidRecognitionServicePackage?: string;
7
7
  }) => Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,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,GACZ,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,mBAAmB,GAAI,UAAU;IAC5C,gCAAgC,CAAC,EAAE,MAAM,CAAC;CAC3C;;;EAAmE,CAAC;AAErE,eAAO,MAAM,4BAA4B,gBACiB,CAAC;AAE3D,eAAO,MAAM,2BAA2B,eACiB,CAAC;AAE1D,eAAO,MAAM,iBAAiB,eAAgD,CAAC;AAE/E,eAAO,MAAM,cAAc,qFAA6C,CAAC;AAEzE,eAAO,MAAM,oCAAoC;;;;CACiB,CAAC;AAEnE,eAAO,MAAM,wBAAwB;;UACiB,CAAC;AAEvD,eAAO,MAAM,kCAAkC;;;;;EACiB,CAAC;AAEjE,eAAO,MAAM,sBAAsB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eACiB,CAAC;AAErD,eAAO,MAAM,4BAA4B;;CACiB,CAAC;AAE3D,eAAO,MAAM,mBAAmB;;CACiB,CAAC;AAElD,eAAO,MAAM,4BAA4B,6TACA,CAAC;AAE1C,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
@@ -6,7 +6,7 @@ export { ExpoSpeechRecognitionModule } from "./ExpoSpeechRecognitionModule";
6
6
  // Hooks
7
7
  export { useSpeechRecognitionEvent } from "./useSpeechRecognitionEvent";
8
8
  // Constants
9
- export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, } from "./constants";
9
+ export { AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentExtraLanguageModel, RecognizerIntentEnableLanguageSwitch, AudioEncodingAndroid, TaskHintIOS, SpeechRecognizerErrorAndroid, } from "./constants";
10
10
  export const getSupportedLocales = (options) => ExpoSpeechRecognitionModule.getSupportedLocales(options ?? {});
11
11
  export const getSpeechRecognitionServices = ExpoSpeechRecognitionModule.getSpeechRecognitionServices;
12
12
  export const supportsOnDeviceRecognition = ExpoSpeechRecognitionModule.supportsOnDeviceRecognition;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,oCAAoC;AACpC,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB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ecognitionModule\";\n\n// 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} from \"./constants\";\n\nexport const getSupportedLocales = (options?: {\n androidRecognitionServicePackage?: string;\n}) => ExpoSpeechRecognitionModule.getSupportedLocales(options ?? {});\n\nexport const getSpeechRecognitionServices =\n ExpoSpeechRecognitionModule.getSpeechRecognitionServices;\n\nexport const supportsOnDeviceRecognition =\n ExpoSpeechRecognitionModule.supportsOnDeviceRecognition;\n\nexport const supportsRecording = ExpoSpeechRecognitionModule.supportsRecording;\n\nexport const setCategoryIOS = ExpoSpeechRecognitionModule.setCategoryIOS;\n\nexport const getAudioSessionCategoryAndOptionsIOS =\n ExpoSpeechRecognitionModule.getAudioSessionCategoryAndOptionsIOS;\n\nexport const setAudioSessionActiveIOS =\n ExpoSpeechRecognitionModule.setAudioSessionActiveIOS;\n\nexport const androidTriggerOfflineModelDownload =\n ExpoSpeechRecognitionModule.androidTriggerOfflineModelDownload;\n\nexport const isRecognitionAvailable =\n ExpoSpeechRecognitionModule.isRecognitionAvailable;\n\nexport const getDefaultRecognitionService =\n ExpoSpeechRecognitionModule.getDefaultRecognitionService;\n\nexport const getAssistantService =\n ExpoSpeechRecognitionModule.getAssistantService;\n\nexport const addSpeechRecognitionListener =\n ExpoSpeechRecognitionModule.addListener;\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,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;AAErB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAEnC,EAAE,EAAE,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,4BAA4B,GACvC,2BAA2B,CAAC,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,2BAA2B,GACtC,2BAA2B,CAAC,2BAA2B,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,iBAAiB,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,2BAA2B,CAAC,cAAc,CAAC;AAEzE,MAAM,CAAC,MAAM,oCAAoC,GAC/C,2BAA2B,CAAC,oCAAoC,CAAC;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GACnC,2BAA2B,CAAC,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,kCAAkC,GAC7C,2BAA2B,CAAC,kCAAkC,CAAC;AAEjE,MAAM,CAAC,MAAM,sBAAsB,GACjC,2BAA2B,CAAC,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,4BAA4B,GACvC,2BAA2B,CAAC,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAC9B,2BAA2B,CAAC,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,4BAA4B,GACvC,2BAA2B,CAAC,WAAW,CAAC","sourcesContent":["import { ExpoSpeechRecognitionModule } from \"./ExpoSpeechRecognitionModule\";\n\n// 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 const getSupportedLocales = (options?: {\n androidRecognitionServicePackage?: string;\n}) => ExpoSpeechRecognitionModule.getSupportedLocales(options ?? {});\n\nexport const getSpeechRecognitionServices =\n ExpoSpeechRecognitionModule.getSpeechRecognitionServices;\n\nexport const supportsOnDeviceRecognition =\n ExpoSpeechRecognitionModule.supportsOnDeviceRecognition;\n\nexport const supportsRecording = ExpoSpeechRecognitionModule.supportsRecording;\n\nexport const setCategoryIOS = ExpoSpeechRecognitionModule.setCategoryIOS;\n\nexport const getAudioSessionCategoryAndOptionsIOS =\n ExpoSpeechRecognitionModule.getAudioSessionCategoryAndOptionsIOS;\n\nexport const setAudioSessionActiveIOS =\n ExpoSpeechRecognitionModule.setAudioSessionActiveIOS;\n\nexport const androidTriggerOfflineModelDownload =\n ExpoSpeechRecognitionModule.androidTriggerOfflineModelDownload;\n\nexport const isRecognitionAvailable =\n ExpoSpeechRecognitionModule.isRecognitionAvailable;\n\nexport const getDefaultRecognitionService =\n ExpoSpeechRecognitionModule.getDefaultRecognitionService;\n\nexport const getAssistantService =\n ExpoSpeechRecognitionModule.getAssistantService;\n\nexport const addSpeechRecognitionListener =\n ExpoSpeechRecognitionModule.addListener;\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-speech-recognition",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Speech Recognition for React Native Expo projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -97,6 +97,15 @@ export type ExpoSpeechRecognitionErrorCode =
97
97
  export type ExpoSpeechRecognitionErrorEvent = {
98
98
  error: ExpoSpeechRecognitionErrorCode;
99
99
  message: string;
100
+ /**
101
+ * The underlying native error code from the platform-specific speech recognition service.
102
+ *
103
+ * - On Android: Maps to SpeechRecognizer error constants (e.g., ERROR_AUDIO = 3)
104
+ * - Value of -1 indicates a generic/unknown error or when native code is not available
105
+ *
106
+ * Usually you won't need this field, but it can be useful for debugging purposes.
107
+ */
108
+ code?: number;
100
109
  };
101
110
 
102
111
  export type LanguageDetectionEvent = {
package/src/constants.ts CHANGED
@@ -347,3 +347,41 @@ export const TaskHintIOS = {
347
347
  */
348
348
  confirmation: "confirmation",
349
349
  } as const;
350
+
351
+ /**
352
+ * An enum of the error codes for the Android SpeechRecognizer class.
353
+ *
354
+ * Docs: https://developer.android.com/reference/android/speech/SpeechRecognizer
355
+ */
356
+ export const SpeechRecognizerErrorAndroid = {
357
+ /** Audio recording error. */
358
+ ERROR_AUDIO: 3,
359
+ /** (API 33+) The service does not allow to check for support. */
360
+ ERROR_CANNOT_CHECK_SUPPORT: 14,
361
+ /** (API 33+) The service does not support listening to model downloads events. */
362
+ ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS: 15,
363
+ /** Other client side errors. */
364
+ ERROR_CLIENT: 5,
365
+ /** Insufficient permissions */
366
+ ERROR_INSUFFICIENT_PERMISSIONS: 9,
367
+ /** Requested language is not available to be used with the current recognizer. */
368
+ ERROR_LANGUAGE_NOT_SUPPORTED: 12,
369
+ /** (API 31+) Requested language is supported, but not available currently (e.g. not downloaded yet). */
370
+ ERROR_LANGUAGE_UNAVAILABLE: 13,
371
+ /** Other network related errors. */
372
+ ERROR_NETWORK: 2,
373
+ /** Network operation timed out. */
374
+ ERROR_NETWORK_TIMEOUT: 1,
375
+ /** No recognition result matched. */
376
+ ERROR_NO_MATCH: 7,
377
+ /** RecognitionService busy. */
378
+ ERROR_RECOGNIZER_BUSY: 8,
379
+ /** Server sends error status. */
380
+ ERROR_SERVER: 4,
381
+ /** Server has been disconnected, e.g. because the app has crashed. */
382
+ ERROR_SERVER_DISCONNECTED: 11,
383
+ /** No speech input */
384
+ ERROR_SPEECH_TIMEOUT: 6,
385
+ /** (API 31+) Too many requests from the same client. */
386
+ ERROR_TOO_MANY_REQUESTS: 10,
387
+ } as const;
package/src/index.ts CHANGED
@@ -22,6 +22,7 @@ export {
22
22
  RecognizerIntentEnableLanguageSwitch,
23
23
  AudioEncodingAndroid,
24
24
  TaskHintIOS,
25
+ SpeechRecognizerErrorAndroid,
25
26
  } from "./constants";
26
27
 
27
28
  export const getSupportedLocales = (options?: {