expo-speech-recognition 0.2.24 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # expo-speech-recognition
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Implemented long form file-based transcriptions for iOS
8
+ - Fixed web speech compatibility
9
+
10
+ ## 0.2.25
11
+
12
+ ### Patch Changes
13
+
14
+ - 24693ad: Initial release!
package/README.md CHANGED
@@ -24,6 +24,7 @@ expo-speech-recognition implements the iOS [`SFSpeechRecognizer`](https://develo
24
24
  - [Polyfilling the Web SpeechRecognition API](#polyfilling-the-web-speechrecognition-api)
25
25
  - [Muting the beep sound on Android](#muting-the-beep-sound-on-android)
26
26
  - [Improving accuracy of single-word prompts](#improving-accuracy-of-single-word-prompts)
27
+ - [Language Detection](#language-detection)
27
28
  - [Platform Compatibility Table](#platform-compatibility-table)
28
29
  - [Common Troubleshooting issues](#common-troubleshooting-issues)
29
30
  - [Android issues](#android-issues)
@@ -35,15 +36,14 @@ expo-speech-recognition implements the iOS [`SFSpeechRecognizer`](https://develo
35
36
  - [requestPermissionsAsync()](#requestpermissionsasync-promisepermissionresponse)
36
37
  - [getPermissionsAsync()](#getpermissionsasync-promisepermissionresponse)
37
38
  - [getStateAsync()](#getstateasync-promisespeechrecognitionstate)
38
- - [addSpeechRecognitionListener()](#addspeechrecognitionlistener)
39
- - [getSupportedLocales()](#getsupportedlocales-promise-locales-string-installedlocales-string-)
39
+ - [getSupportedLocales()](#getsupportedlocales)
40
40
  - [getSpeechRecognitionServices()](#getspeechrecognitionservices-string-android-only)
41
41
  - [getDefaultRecognitionService()](#getdefaultrecognitionservice--packagename-string--android-only)
42
42
  - [getAssistantService()](#getassistantservice--packagename-string--android-only)
43
43
  - [isRecognitionAvailable()](#isrecognitionavailable-boolean)
44
44
  - [supportsOnDeviceRecognition()](#supportsondevicerecognition-boolean)
45
45
  - [supportsRecording()](#supportsrecording-boolean)
46
- - [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload-locale-string--promise-status-opened_dialog--download_success--download_canceled-message-string-)
46
+ - [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload)
47
47
  - [setCategoryIOS()](#setcategoryios-void-ios-only)
48
48
  - [getAudioSessionCategoryAndOptionsIOS()](#getaudiosessioncategoryandoptionsios-ios-only)
49
49
  - [setAudioSessionActiveIOS()](#setaudiosessionactiveiosvalue-boolean-options--notifyothersondeactivation-boolean--void)
@@ -98,10 +98,13 @@ If you've just created a new Expo project or have only been using the Expo SDK s
98
98
  After completing **Step 2: Configure the config plugin**, follow these steps:
99
99
 
100
100
  - To (re)-generate the native Android project, run:
101
+
101
102
  ```bash
102
103
  npx expo run:android
103
104
  ```
105
+
104
106
  - To (re)-generate the native iOS project, run:
107
+
105
108
  ```bash
106
109
  npx expo run:ios
107
110
  ```
@@ -138,7 +141,7 @@ function App() {
138
141
  setTranscript(event.results[0]?.transcript);
139
142
  });
140
143
  useSpeechRecognitionEvent("error", (event) => {
141
- console.log("error code:", event.error, "error messsage:", event.message);
144
+ console.log("error code:", event.error, "error message:", event.message);
142
145
  });
143
146
 
144
147
  const handleStart = async () => {
@@ -204,32 +207,35 @@ ExpoSpeechRecognitionModule.requestPermissionsAsync().then((result) => {
204
207
  You can also use the `ExpoSpeechRecognitionModule` to use the native APIs directly. The listener events are similar to the Web Speech API.
205
208
 
206
209
  ```ts
207
- import {
208
- ExpoSpeechRecognitionModule,
209
- addSpeechRecognitionListener,
210
- } from "expo-speech-recognition";
210
+ import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
211
211
 
212
212
  // Register event listeners
213
- const startListener = addSpeechRecognitionListener("start", () => {
213
+ const startListener = ExpoSpeechRecognitionModule.addListener("start", () => {
214
214
  console.log("Speech recognition started");
215
215
  });
216
216
 
217
217
  // and remove the listener when you're done:
218
218
  startListener.remove();
219
219
 
220
- const endListener = addSpeechRecognitionListener("end", () => {
220
+ const endListener = ExpoSpeechRecognitionModule.addListener("end", () => {
221
221
  console.log("Speech recognition ended");
222
222
  });
223
223
 
224
- const resultListener = addSpeechRecognitionListener("result", (event) => {
225
- // Note: this is not the same as the `result` event listener on the web speech API
226
- // event.results is an array of results (e.g. `[{ transcript: "hello", confidence: 0.5, segments: [] }]`)
227
- console.log("results:", event.results, "final:", event.isFinal);
228
- });
224
+ const resultListener = ExpoSpeechRecognitionModule.addListener(
225
+ "result",
226
+ (event) => {
227
+ // Note: this is not the same as the `result` event listener on the web speech API
228
+ // event.results is an array of results (e.g. `[{ transcript: "hello", confidence: 0.5, segments: [] }]`)
229
+ console.log("results:", event.results, "final:", event.isFinal);
230
+ },
231
+ );
229
232
 
230
- const errorListener = addSpeechRecognitionListener("error", (event) => {
231
- console.log("error code:", event.error, "error messsage:", event.message);
232
- });
233
+ const errorListener = ExpoSpeechRecognitionModule.addListener(
234
+ "error",
235
+ (event) => {
236
+ console.log("error code:", event.error, "error message:", event.message);
237
+ },
238
+ );
233
239
 
234
240
  // Start speech recognition
235
241
  ExpoSpeechRecognitionModule.start({
@@ -247,6 +253,7 @@ ExpoSpeechRecognitionModule.start({
247
253
  // [Default: false] Prevent device from sending audio over the network. Only enabled if the device supports it.
248
254
  requiresOnDeviceRecognition: false,
249
255
  // [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.
256
+ // Not supported on Android 12 and below. On Android 13+, only supported when on-device recognition is enabled.
250
257
  addsPunctuation: false,
251
258
  // [Default: undefined] Short custom phrases that are unique to your app.
252
259
  contextualStrings: ["Carlsen", "Nepomniachtchi", "Praggnanandhaa"],
@@ -321,18 +328,19 @@ ExpoSpeechRecognitionModule.abort();
321
328
 
322
329
  Events are largely based on the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition). The following events are supported:
323
330
 
324
- | Event Name | Description | Notes |
325
- | -------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
326
- | `audiostart` | Audio capturing has started | Includes the `uri` if `recordingOptions.persist` is enabled. |
327
- | `audioend` | Audio capturing has ended | Includes the `uri` if `recordingOptions.persist` is enabled. |
328
- | `end` | Speech recognition service has disconnected. | This should always be the last event dispatched, including after errors. |
329
- | `error` | Fired when a speech recognition error occurs. | You'll also receive an `error` event (with code "aborted") when calling `.abort()` |
330
- | `nomatch` | Speech recognition service returns a final result with no significant recognition. | You may have non-final results recognized. This may get emitted after cancellation. |
331
- | `result` | Speech recognition service returns a word or phrase has been positively recognized. | On Android, continous mode runs as a segmented session, meaning when a final result is reached, additional partial and final results will cover a new segment separate from the previous final result. On iOS, you should expect one final result before speech recognition has stopped. |
332
- | `speechstart` | Fired when any sound — recognizable speech or not — has been detected | On iOS, this will fire once in the session after a result has occurred |
333
- | `speechend` | Fired when speech recognized by the speech recognition service has stopped being detected. | Not supported yet on iOS |
334
- | `start` | Speech recognition has started | Use this event to indicate to the user when to speak. |
335
- | `volumechange` | Fired when the input volume changes. | Returns a value between -2 and 10 indicating the volume of the input audio. Consider anything below 0 to be inaudible. |
331
+ | Event Name | Description | Notes |
332
+ | ------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
333
+ | `audiostart` | Audio capturing has started | Includes the `uri` if `recordingOptions.persist` is enabled. |
334
+ | `audioend` | Audio capturing has ended | Includes the `uri` if `recordingOptions.persist` is enabled. |
335
+ | `end` | Speech recognition service has disconnected. | This should always be the last event dispatched, including after errors. |
336
+ | `error` | Fired when a speech recognition error occurs. | You'll also receive an `error` event (with code "aborted") when calling `.abort()` |
337
+ | `nomatch` | Speech recognition service returns a final result with no significant recognition. | You may have non-final results recognized. This may get emitted after cancellation. |
338
+ | `result` | Speech recognition service returns a word or phrase has been positively recognized. | On Android, continous mode runs as a segmented session, meaning when a final result is reached, additional partial and final results will cover a new segment separate from the previous final result. On iOS, you should expect one final result before speech recognition has stopped. |
339
+ | `speechstart` | Fired when any sound — recognizable speech or not — has been detected | On iOS, this will fire once in the session after a result has occurred |
340
+ | `speechend` | Fired when speech recognized by the speech recognition service has stopped being detected. | Not supported yet on iOS |
341
+ | `start` | Speech recognition has started | Use this event to indicate to the user when to speak. |
342
+ | `volumechange` | Fired when the input volume changes. | Returns a value between -2 and 10 indicating the volume of the input audio. Consider anything below 0 to be inaudible. |
343
+ | `languagedetection` | Called when the language detection (and switching) results are available. | Android 14+ only with `com.google.android.as`. Enabled with `EXTRA_ENABLE_LANGUAGE_DETECTION` in the `androidIntent` option when starting. Also can be called multiple times by enabling `EXTRA_ENABLE_LANGUAGE_SWITCH`. |
336
344
 
337
345
  ## Handling Errors
338
346
 
@@ -341,17 +349,17 @@ To handle errors, you can listen to the `error` event:
341
349
  ```ts
342
350
  import {
343
351
  type ExpoSpeechRecognitionErrorCode,
344
- addSpeechRecognitionListener,
352
+ ExpoSpeechRecognitionModule,
345
353
  useSpeechRecognitionEvent,
346
354
  } from "expo-speech-recognition";
347
355
 
348
- addSpeechRecognitionListener("error", (event) => {
349
- console.log("error code:", event.error, "error messsage:", event.message);
356
+ ExpoSpeechRecognitionModule.addListener("error", (event) => {
357
+ console.log("error code:", event.error, "error message:", event.message);
350
358
  });
351
359
 
352
360
  // or through the `useSpeechRecognitionEvent` hook
353
361
  useSpeechRecognitionEvent("error", (event) => {
354
- console.log("error code:", event.error, "error messsage:", event.message);
362
+ console.log("error code:", event.error, "error message:", event.message);
355
363
  });
356
364
 
357
365
  // or through the `ExpoSpeechRecognitionErrorCode` type
@@ -466,7 +474,7 @@ function AudioPlayer(props: { source: string }) {
466
474
  > [!IMPORTANT]
467
475
  > This feature is available on Android 13+ and iOS. If the device does not support the feature, you'll receive an `error` event with the code `audio-capture`.
468
476
 
469
- Instead of using the microphone, you can configure the `audioSource.uri` option to transcribe audio files.
477
+ Instead of using the microphone, you can configure the `audioSource.uri` option to transcribe audio files. For long-form audio files, you will likely want to use on-device recognition instead of network-based recognition which you can opt-in via `requiresOnDeviceRecognition`. For Android, you should first check if the user has the speech model installed with `getSupportedLocales()`.
470
478
 
471
479
  ### Supported input audio formats
472
480
 
@@ -481,8 +489,6 @@ The following audio formats have been verified on a Samsung Galaxy S23 Ultra on
481
489
 
482
490
  #### iOS
483
491
 
484
- > Due to a limitation in the underlying `SFSpeechURLRecognitionRequest` API, file-based transcription will only transcribe the **first 1 minute of the audio file**.
485
-
486
492
  The following audio formats have been verified on an iPhone 15 Pro Max on iOS 17.5:
487
493
 
488
494
  - 16000hz 16-bit 1-channel PCM WAV ([example file](https://github.com/jamsch/expo-speech-recognition/blob/main/example/assets/audio-remote/remote-en-us-sentence-16000hz-pcm_s16le.wav))
@@ -505,6 +511,8 @@ function TranscribeAudioFile() {
505
511
  ExpoSpeechRecognitionModule.start({
506
512
  lang: "en-US",
507
513
  interimResults: true,
514
+ // Recommended: true on iOS, false on Android, unless the speech model is installed, which you can check with `getSupportedLocales()`
515
+ requiresOnDeviceRecognition: Platform.OS === "ios",
508
516
  audioSource: {
509
517
  /** Local file URI */
510
518
  uri: "file:///path/to/audio.wav",
@@ -515,7 +523,7 @@ function TranscribeAudioFile() {
515
523
  /** [Android only] Audio sampling rate in Hz. */
516
524
  sampleRate: 16000,
517
525
  /**
518
- * [Android only] The delay between chunks of audio to stream to the speech recognition service.
526
+ * The delay between chunks of audio to stream to the speech recognition service.
519
527
  * Use this setting to avoid being rate-limited when using network-based recognition.
520
528
  * If you're using on-device recognition, you may want to increase this value to avoid unprocessed audio chunks.
521
529
  * Default: 50ms for network-based recognition, 15ms for on-device recognition
@@ -526,7 +534,7 @@ function TranscribeAudioFile() {
526
534
  };
527
535
 
528
536
  useSpeechRecognitionEvent("result", (ev) => {
529
- // Note: multiple final results will likely be returned on Android
537
+ // Note: multiple final results will likely be returned
530
538
  // so you'll need to concatenate previous final results
531
539
  setTranscription(ev.results[0]?.transcript || "");
532
540
  });
@@ -551,10 +559,15 @@ You can use the `volumeChangeEventOptions.enabled` option to enable volume meter
551
559
  See: [VolumeMeteringAvatar.tsx](https://github.com/jamsch/expo-speech-recognition/tree/main/example/components/VolumeMeteringAvatar.tsx) for a complete example that involves using `react-native-reanimated` to animate the volume metering.
552
560
 
553
561
  ```tsx
554
- import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
562
+ import { Button } from "react-native";
563
+ import {
564
+ ExpoSpeechRecognitionModule,
565
+ useSpeechRecognitionEvent,
566
+ } from "expo-speech-recognition";
555
567
 
556
- function VolumeMeteringAvatar() {
568
+ function VolumeMeteringExample() {
557
569
  useSpeechRecognitionEvent("volumechange", (event) => {
570
+ // a value between -2 and 10. <= 0 is inaudible
558
571
  console.log("Volume changed to:", event.value);
559
572
  });
560
573
 
@@ -563,17 +576,13 @@ function VolumeMeteringAvatar() {
563
576
  lang: "en-US",
564
577
  volumeChangeEventOptions: {
565
578
  enabled: true,
579
+ // how often you want to receive the volumechange event
566
580
  intervalMillis: 300,
567
581
  },
568
582
  });
569
583
  };
570
584
 
571
- return (
572
- <View>
573
- <Button title="Start" onPress={handleStart} />
574
- <Text>Volume: {volume}</Text>
575
- </View>
576
- );
585
+ return <Button title="Start" onPress={handleStart} />;
577
586
  }
578
587
  ```
579
588
 
@@ -642,7 +651,7 @@ const handleResult = (event: SpeechRecognitionEvent) => {
642
651
  recognition.registerEventListener("result", handleResult);
643
652
 
644
653
  recognition.registerEventListener("error", (event) => {
645
- console.log("error code:", event.error, "error messsage:", event.message);
654
+ console.log("error code:", event.error, "error message:", event.message);
646
655
  });
647
656
 
648
657
  recognition.registerEventListener("end", (event) => console.log("ended!"));
@@ -694,6 +703,39 @@ You may notice that after saying short syllables, words, letters, or numbers (e.
694
703
  - For both platforms, you also may want to consider using on-device recognition. On Android this seems to work well for single-word prompts.
695
704
  - Alternatively, you may want to consider recording the recognized audio and sending it to an external service for further processing. See [Persisting Audio Recordings](#persisting-audio-recordings) for more information. Note that some services (such as the Google Speech API) may require an audio file with a duration of at least 3 seconds.
696
705
 
706
+ ## Language Detection
707
+
708
+ > [!NOTE]
709
+ > This feature is currently only available on Android 14+ using the `com.google.android.as` service package.
710
+
711
+ You can use the `languagedetection` event to get the detected language and confidence level. This feature has a few requirements:
712
+
713
+ - Android 14+ only.
714
+ - The `com.google.android.as` (on-device recognition) service package must be selected. This seems to be the only service that supports language detection as of writing this.
715
+ - You must enable `EXTRA_ENABLE_LANGUAGE_DETECTION` in the `androidIntentOptions` when starting the recognition.
716
+ - Optional: You can enable `EXTRA_ENABLE_LANGUAGE_SWITCH` to allow the user to switch languages, however **keep in mind that you need the language model to be downloaded for this to work**. Refer to [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload) to download a model, and [getSupportedLocales()](#getsupportedlocales) to get the list of downloaded on-device locales.
717
+
718
+ Example:
719
+
720
+ ```tsx
721
+ import { useSpeechRecognitionEvent } from "expo-speech-recognition";
722
+
723
+ useSpeechRecognitionEvent("languagedetection", (event) => {
724
+ console.log("Language detected:", event.detectedLanguage); // e.g. "en-us"
725
+ console.log("Confidence:", event.confidence); // A value between 0.0 and 1.0
726
+ console.log("Top locale alternatives:", event.topLocaleAlternatives); // e.g. ["en-au", "en-gb"]
727
+ });
728
+
729
+ // Start recognition
730
+ ExpoSpeechRecognitionModule.start({
731
+ androidIntentOptions: {
732
+ EXTRA_ENABLE_LANGUAGE_DETECTION: true,
733
+ EXTRA_ENABLE_LANGUAGE_SWITCH: true,
734
+ },
735
+ androidRecognitionServicePackage: "com.google.android.as", // or set "requiresOnDeviceRecognition" to true
736
+ });
737
+ ```
738
+
697
739
  ## Platform Compatibility Table
698
740
 
699
741
  As of 7 Aug 2024, the following platforms are supported:
@@ -789,10 +831,9 @@ ExpoSpeechRecognitionModule.abort();
789
831
 
790
832
  ### `requestPermissionsAsync(): Promise<PermissionResponse>`
791
833
 
792
- Presents a dialog to the user to request permissions for using speech recognition and the microphone.
834
+ Presents a dialog to the user to request the necessary permissions.
793
835
 
794
- For iOS, once a user has granted (or denied) location permissions by responding to the original permission request dialog,
795
- the only way that the permissions can be changed is by the user themselves using the device settings app.
836
+ For iOS, this requests two permissions: record permissions (to access the microphone), and speech recognition permissions. Once a user has granted (or denied) permissions by responding to the original permission request dialog, the only way that the permissions can be changed is by the user themselves using the device settings app.
796
837
 
797
838
  ```ts
798
839
  import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
@@ -834,23 +875,7 @@ ExpoSpeechRecognitionModule.getStateAsync().then((state) => {
834
875
  });
835
876
  ```
836
877
 
837
- ### `addSpeechRecognitionListener()`
838
-
839
- Refer to [Speech Recognition Events](#speech-recognition-events) for the list of supported events.
840
-
841
- ```ts
842
- import { addSpeechRecognitionListener } from "expo-speech-recognition";
843
-
844
- const listener = addSpeechRecognitionListener("result", (event) => {
845
- console.log("transcript:", event.results[0]?.transcript);
846
- console.log("confidence:", event.results[0]?.confidence);
847
- });
848
-
849
- // Remove the listener when you're done
850
- listener.remove();
851
- ```
852
-
853
- ### `getSupportedLocales(): Promise<{ locales: string[]; installedLocales: string[] }>`
878
+ ### `getSupportedLocales()`
854
879
 
855
880
  > [!NOTE]
856
881
  > Not supported on Android 12 and below
@@ -964,7 +989,7 @@ const available = supportsRecording();
964
989
  console.log("Recording available:", available);
965
990
  ```
966
991
 
967
- ### `androidTriggerOfflineModelDownload({ locale: string }): Promise<{ status: "opened_dialog" | "download_success" | "download_canceled", message: string }>`
992
+ ### `androidTriggerOfflineModelDownload()`
968
993
 
969
994
  Users on Android devices will first need to download the offline model for the locale they want to use in order to use on-device speech recognition (i.e. the `requiresOnDeviceRecognition` setting in the `start` options).
970
995
 
@@ -6,6 +6,7 @@ import android.content.ComponentName
6
6
  import android.content.Context
7
7
  import android.content.Intent
8
8
  import android.os.Build
9
+ import android.os.Bundle
9
10
  import android.os.Handler
10
11
  import android.provider.Settings
11
12
  import android.speech.ModelDownloadListener
@@ -16,6 +17,7 @@ import android.speech.RecognizerIntent
16
17
  import android.speech.SpeechRecognizer
17
18
  import android.util.Log
18
19
  import androidx.annotation.RequiresApi
20
+ import expo.modules.interfaces.permissions.PermissionsResponse
19
21
  import expo.modules.interfaces.permissions.Permissions.askForPermissionsWithPermissionsManager
20
22
  import expo.modules.interfaces.permissions.Permissions.getPermissionsWithPermissionsManager
21
23
  import expo.modules.kotlin.Promise
@@ -86,6 +88,8 @@ class ExpoSpeechRecognitionModule : Module() {
86
88
  "start",
87
89
  // Called when there's results (as a string array, not API compliant)
88
90
  "results",
91
+ // Called when the language detection (and switching) results are available.
92
+ "languagedetection",
89
93
  // Fired when the input volume changes
90
94
  "volumechange",
91
95
  )
@@ -141,6 +145,46 @@ class ExpoSpeechRecognitionModule : Module() {
141
145
  )
142
146
  }
143
147
 
148
+ AsyncFunction("requestMicrophonePermissionsAsync") { promise: Promise ->
149
+ askForPermissionsWithPermissionsManager(
150
+ appContext.permissions,
151
+ promise,
152
+ RECORD_AUDIO,
153
+ )
154
+ }
155
+
156
+ AsyncFunction("getMicrophonePermissionsAsync") { promise: Promise ->
157
+ getPermissionsWithPermissionsManager(
158
+ appContext.permissions,
159
+ promise,
160
+ RECORD_AUDIO,
161
+ )
162
+ }
163
+
164
+ AsyncFunction("getSpeechRecognizerPermissionsAsync") { promise: Promise ->
165
+ Log.w("ExpoSpeechRecognitionModule", "getSpeechRecognizerPermissionsAsync is not supported on Android. Returning a granted permission response.")
166
+ promise.resolve(
167
+ Bundle().apply {
168
+ putString(PermissionsResponse.EXPIRES_KEY, "never")
169
+ putString(PermissionsResponse.STATUS_KEY, "granted")
170
+ putBoolean(PermissionsResponse.CAN_ASK_AGAIN_KEY, false)
171
+ putBoolean(PermissionsResponse.GRANTED_KEY, true)
172
+ }
173
+ )
174
+ }
175
+
176
+ AsyncFunction("requestSpeechRecognizerPermissionsAsync") { promise: Promise ->
177
+ Log.w("ExpoSpeechRecognitionModule", "requestSpeechRecognizerPermissionsAsync is not supported on Android. Returning a granted permission response.")
178
+ promise.resolve(
179
+ Bundle().apply {
180
+ putString(PermissionsResponse.EXPIRES_KEY, "never")
181
+ putString(PermissionsResponse.STATUS_KEY, "granted")
182
+ putBoolean(PermissionsResponse.CAN_ASK_AGAIN_KEY, false)
183
+ putBoolean(PermissionsResponse.GRANTED_KEY, true)
184
+ }
185
+ )
186
+ }
187
+
144
188
  AsyncFunction("getStateAsync") { promise: Promise ->
145
189
  val state =
146
190
  when (expoSpeechService.recognitionState) {
@@ -60,6 +60,9 @@ class ExpoSpeechService(
60
60
  private var delayedFileStreamer: DelayedFileStreamer? = null
61
61
  private var soundState = SoundState.INACTIVE
62
62
 
63
+ private var lastDetectedLanguage: String? = null
64
+ private var lastLanguageConfidence: Float? = null
65
+
63
66
  var recognitionState = RecognitionState.INACTIVE
64
67
 
65
68
  companion object {
@@ -121,6 +124,8 @@ class ExpoSpeechService(
121
124
  audioRecorder = null
122
125
  delayedFileStreamer?.close()
123
126
  delayedFileStreamer = null
127
+ lastDetectedLanguage = null
128
+ lastLanguageConfidence = null
124
129
  recognitionState = RecognitionState.STARTING
125
130
  soundState = SoundState.INACTIVE
126
131
  lastVolumeChangeEventTime = 0L
@@ -433,12 +438,12 @@ class ExpoSpeechService(
433
438
  */
434
439
  private fun resolveSourceUri(sourceUri: String): File =
435
440
  when {
436
- // Local file path without URI scheme
437
- !sourceUri.startsWith("https://") && !sourceUri.startsWith("file://") -> File(sourceUri)
438
-
439
441
  // File URI
440
442
  sourceUri.startsWith("file://") -> File(URI(sourceUri))
441
443
 
444
+ // Local file path without URI scheme
445
+ !sourceUri.startsWith("https://") -> File(sourceUri)
446
+
442
447
  // HTTP URI - throw an error
443
448
  else -> {
444
449
  throw Exception("HTTP URI is not supported. Use expo-file-system to download the file.")
@@ -581,6 +586,15 @@ class ExpoSpeechService(
581
586
  else -> 0.0f
582
587
  }
583
588
 
589
+ private fun languageDetectionConfidenceLevelToFloat(confidenceLevel: Int): Float =
590
+ when (confidenceLevel) {
591
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT -> 1.0f
592
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT -> 0.8f
593
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT -> 0.5f
594
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_UNKNOWN -> 0f
595
+ else -> 0.0f
596
+ }
597
+
584
598
  override fun onResults(results: Bundle?) {
585
599
  val resultsList = getResults(results)
586
600
 
@@ -614,6 +628,26 @@ class ExpoSpeechService(
614
628
  }
615
629
  }
616
630
 
631
+ override fun onLanguageDetection(results: Bundle) {
632
+ val detectedLanguage = results.getString(SpeechRecognizer.DETECTED_LANGUAGE)
633
+ val confidence = languageDetectionConfidenceLevelToFloat(results.getInt(SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL))
634
+
635
+ // Only send event if language or confidence has changed
636
+ if (detectedLanguage != lastDetectedLanguage || confidence != lastLanguageConfidence) {
637
+ lastDetectedLanguage = detectedLanguage
638
+ lastLanguageConfidence = confidence
639
+
640
+ sendEvent(
641
+ "languagedetection",
642
+ mapOf(
643
+ "detectedLanguage" to detectedLanguage,
644
+ "confidence" to confidence,
645
+ "topLocaleAlternatives" to results.getStringArrayList(SpeechRecognizer.TOP_LOCALE_ALTERNATIVES),
646
+ ),
647
+ )
648
+ }
649
+ }
650
+
617
651
  /**
618
652
  * For API 33: Basically same as onResults but doesn't stop
619
653
  */
@@ -70,6 +70,22 @@ export type ExpoSpeechRecognitionErrorEvent = {
70
70
  error: ExpoSpeechRecognitionErrorCode;
71
71
  message: string;
72
72
  };
73
+ export type LanguageDetectionEvent = {
74
+ /** The language that was detected, in BCP-47 format. e.g. "en-US", "de-DE" */
75
+ detectedLanguage: string;
76
+ /** The confidence of the detected language. A value ranging between 0.0 and 1.0.
77
+ *
78
+ * Values range from:
79
+ *
80
+ * - 1.0 (highly confident)
81
+ * - 0.8 (confident)
82
+ * - 0.5 (not confident)
83
+ * - 0.0 (unknown)
84
+ */
85
+ confidence: number;
86
+ /** The alternative locales for the same language, in BCP-47 format. e.g. ["en-US", "en-GB"] */
87
+ topLocaleAlternatives: string[];
88
+ };
73
89
  /**
74
90
  * Events that are dispatched from the native side
75
91
  */
@@ -109,6 +125,7 @@ export type ExpoSpeechRecognitionNativeEventMap = {
109
125
  end: null;
110
126
  soundstart: null;
111
127
  soundend: null;
128
+ languagedetection: LanguageDetectionEvent;
112
129
  volumechange: {
113
130
  /**
114
131
  * A float value between -2 and 10 indicating the volume of the input audio
@@ -152,7 +169,9 @@ export type ExpoSpeechRecognitionOptions = {
152
169
  /**
153
170
  * [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.
154
171
  *
155
- * On Android, this configures [`EXTRA_ENABLE_FORMATTING`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING) in the recognizer intent (API level 33+).
172
+ * 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+).
173
+ *
174
+ * 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)
156
175
  *
157
176
  * On iOS, this configures [`SFSpeechRecognitionRequest.addsPunctuation`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/3930023-addspunctuation).
158
177
  */
@@ -337,6 +356,15 @@ export type AndroidIntentOptions = {
337
356
  * Depending on the recognizer implementation, this value may have no effect.
338
357
  */
339
358
  EXTRA_ENABLE_LANGUAGE_SWITCH: (typeof RecognizerIntentEnableLanguageSwitch)[keyof typeof RecognizerIntentEnableLanguageSwitch];
359
+ /**
360
+ * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING
361
+ *
362
+ * NOTE: This is also configurable through `addsPunctuation` (which sets `EXTRA_ENABLE_FORMATTING` to "quality")
363
+ *
364
+ * [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.
365
+ *
366
+ */
367
+ EXTRA_ENABLE_FORMATTING: "latency" | "quality";
340
368
  /**
341
369
  * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION
342
370
  *
@@ -488,14 +516,42 @@ export interface ExpoSpeechRecognitionModuleType extends NativeModule {
488
516
  /**
489
517
  * Presents a dialog to the user to request permissions for using speech recognition and the microphone.
490
518
  *
491
- * For iOS, once a user has granted (or denied) location permissions by responding to the original permission request dialog,
519
+ * For Android, this will request RECORD_AUDIO permission.
520
+ *
521
+ * For iOS, this will request microphone and speech recognition permissions.
522
+ * Once a user has granted (or denied) permissions by responding to the original permission request dialog,
492
523
  * the only way that the permissions can be changed is by the user themselves using the device settings app.
493
524
  */
494
525
  requestPermissionsAsync(): Promise<PermissionResponse>;
495
526
  /**
496
- * Returns the current permission status for the microphone and speech recognition.
527
+ * Returns the current permission status for speech recognition and the microphone.
528
+ *
529
+ * You may also use `getMicrophonePermissionsAsync` and `getSpeechRecognizerPermissionsAsync` to get the permissions separately.
497
530
  */
498
531
  getPermissionsAsync(): Promise<PermissionResponse>;
532
+ /**
533
+ * Returns the current permission status for the microphone.
534
+ */
535
+ getMicrophonePermissionsAsync(): Promise<PermissionResponse>;
536
+ /**
537
+ * Presents a dialog to the user to request permissions for using the microphone.
538
+ *
539
+ * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,
540
+ * the only way that the permissions can be changed is by the user themselves using the device settings app.
541
+ */
542
+ requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;
543
+ /**
544
+ * Returns the current permission status for speech recognition.
545
+ */
546
+ getSpeechRecognizerPermissionsAsync(): Promise<PermissionResponse>;
547
+ /**
548
+ * [iOS only] Presents a dialog to the user to request permissions for using the speech recognizer.
549
+ * This permission is required when `requiresOnDeviceRecognition` is disabled (i.e. network-based recognition)
550
+ *
551
+ * For iOS, once a user has granted (or denied) permissions by responding to the original permission request dialog,
552
+ * the only way that the permissions can be changed is by the user themselves using the device settings app.
553
+ */
554
+ requestSpeechRecognizerPermissionsAsync(): Promise<PermissionResponse>;
499
555
  /**
500
556
  * Returns an array of locales supported by the speech recognizer.
501
557
  *
@@ -1 +1 @@
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,cAAc,CAAC;AAEjD,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,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,EAAE,kCAAkC,EAAE,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,qHAAqH;IACrH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,gCAAgC,GAAG;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,O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AM,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,cAAc,CAAC;AAEjD,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,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,EAAE,kCAAkC,EAAE,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,qHAAqH;IACrH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,gCAAgC,GAAG;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,2BAA2B,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,8BAA8B;AACxC,6DAA6D;AAC3D,SAAS;AACX,6BAA6B;GAC3B,eAAe;AACjB,kJA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