{"id":13469015,"url":"https://github.com/react-native-voice/voice","last_synced_at":"2025-05-14T02:08:56.097Z","repository":{"id":37429476,"uuid":"58229409","full_name":"react-native-voice/voice","owner":"react-native-voice","description":":microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)","archived":false,"fork":false,"pushed_at":"2025-03-04T14:09:00.000Z","size":2790,"stargazers_count":1945,"open_issues_count":265,"forks_count":541,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-03T22:02:48.195Z","etag":null,"topics":["android","ios","react-native","speech-recognition","voice-recognition"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/react-native-voice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-06T19:11:39.000Z","updated_at":"2025-05-02T15:42:32.000Z","dependencies_parsed_at":"2023-02-16T13:30:55.202Z","dependency_job_id":"9b85c380-2802-4434-95bf-618ee8804635","html_url":"https://github.com/react-native-voice/voice","commit_stats":{"total_commits":153,"total_committers":54,"mean_commits":"2.8333333333333335","dds":0.7908496732026143,"last_synced_commit":"32aab8b00e57132fa3de204f86d75635c969e5d4"},"previous_names":["react-native-community/voice","wenkesj/react-native-voice","react-native-community/react-native-voice"],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-voice%2Fvoice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-voice%2Fvoice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-voice%2Fvoice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-native-voice%2Fvoice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/react-native-voice","download_url":"https://codeload.github.com/react-native-voice/voice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254053219,"owners_count":22006717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","react-native","speech-recognition","voice-recognition"],"created_at":"2024-07-31T15:01:24.485Z","updated_at":"2025-05-14T02:08:51.083Z","avatar_url":"https://github.com/react-native-voice.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![CircleCI branch][circle-ci-badge]\n[![npm][npm]][npm-url]\n\n\u003ch1 align=\"center\"\u003eReact Native Voice\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA speech-to-text library for \u003ca href=\"https://reactnative.dev/\"\u003eReact Native.\u003c/a\u003e\u003c/p\u003e\n\n\u003ca href=\"https://discord.gg/CJHKVeW6sp\"\u003e\n\u003cimg src=\"https://img.shields.io/discord/764994995098615828?label=Discord\u0026logo=Discord\u0026style=for-the-badge\"\n            alt=\"chat on Discord\"\u003e\u003c/a\u003e\n\n```sh\nyarn add @react-native-voice/voice\n\n# or\n\nnpm i @react-native-voice/voice --save\n```\n\nLink the iOS package\n\n```sh\nnpx pod-install\n```\n\n## Table of contents\n\n- [Linking](#linking)\n  - [Manually Link Android](#manually-link-android)\n  - [Manually Link iOS](#manually-link-ios)\n- [Prebuild Plugin](#prebuild-plugin)\n- [Usage](#usage)\n  - [Example](#example)\n- [API](#api)\n- [Events](#events)\n- [Permissions](#permissions)\n  - [Android](#android)\n  - [iOS](#ios)\n- [Contributors](#contributors)\n\n\u003ch2 align=\"center\"\u003eLinking\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eManually or automatically link the NativeModule\u003c/p\u003e\n\n```sh\nreact-native link @react-native-voice/voice\n```\n\n### Manually Link Android\n\n- In `android/setting.gradle`\n\n```gradle\n...\ninclude ':@react-native-voice_voice', ':app'\nproject(':@react-native-voice_voice').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-voice/voice/android')\n```\n\n- In `android/app/build.gradle`\n\n```gradle\n...\ndependencies {\n    ...\n    compile project(':@react-native-voice_voice')\n}\n```\n\n- In `MainApplication.java`\n\n```java\n\nimport android.app.Application;\nimport com.facebook.react.ReactApplication;\nimport com.facebook.react.ReactPackage;\n...\nimport com.wenkesj.voice.VoicePackage; // \u003c------ Add this!\n...\n\npublic class MainActivity extends Activity implements ReactApplication {\n...\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n      return Arrays.\u003cReactPackage\u003easList(\n        new MainReactPackage(),\n        new VoicePackage() // \u003c------ Add this!\n        );\n    }\n}\n```\n\n### Manually Link iOS\n\n- Drag the Voice.xcodeproj from the @react-native-voice/voice/ios folder to the Libraries group on Xcode in your poject. [Manual linking](https://reactnative.dev/docs/linking-libraries-ios.html)\n\n- Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag the static library, lib.Voice.a, from the Libraries/Voice.xcodeproj/Products folder to Link Binary With Libraries\n\n\u003ch2 align=\"center\"\u003ePrebuild Plugin\u003c/h2\u003e\n\n\u003e This package cannot be used in the \"Expo Go\" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).\n\nAfter installing this npm package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\"@react-native-voice/voice\"]\n  }\n}\n```\n\nNext, rebuild your app as described in the [\"Adding custom native code\"](https://docs.expo.io/workflow/customizing/) guide.\n\n### Props\n\nThe plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.\n\n- `speechRecognition` (_string | false_): Sets the message for the `NSSpeechRecognitionUsageDescription` key in the `Info.plist` message. When undefined, a default permission message will be used. When `false`, the permission will be skipped.\n- `microphone` (_string | false_): Sets the message for the `NSMicrophoneUsageDescription` key in the `Info.plist`. When undefined, a default permission message will be used. When `false`, the `android.permission.RECORD_AUDIO` will not be added to the `AndroidManifest.xml` and the iOS permission will be skipped.\n\n### Example\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@react-native-voice/voice\",\n      {\n        \"microphonePermission\": \"CUSTOM: Allow $(PRODUCT_NAME) to access the microphone\",\n        \"speechRecognitionPermission\": \"CUSTOM: Allow $(PRODUCT_NAME) to securely recognize user speech\"\n      }\n    ]\n  ]\n}\n```\n\n\u003ch2 align=\"center\"\u003eUsage\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/react-native-voice/voice/blob/master/example/src/VoiceTest.tsx\"\u003eFull example for Android and iOS.\u003c/a\u003e\u003c/p\u003e\n\n### Example\n\n```javascript\nimport Voice from '@react-native-voice/voice';\nimport React, {Component} from 'react';\n\nclass VoiceTest extends Component {\n  constructor(props) {\n    Voice.onSpeechStart = this.onSpeechStartHandler.bind(this);\n    Voice.onSpeechEnd = this.onSpeechEndHandler.bind(this);\n    Voice.onSpeechResults = this.onSpeechResultsHandler.bind(this);\n  }\n  onStartButtonPress(e){\n    Voice.start('en-US');\n  }\n  ...\n}\n```\n\n\u003ch2 align=\"center\"\u003eAPI\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eStatic access to the Voice API.\u003c/p\u003e\n\n**All methods _now_ return a `new Promise` for `async/await` compatibility.**\n\n| Method Name                          | Description                                                                                                                                                             | Platform     |\n| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |\n| Voice.isAvailable()                  | Checks whether a speech recognition service is available on the system.                                                                                                 | Android, iOS |\n| Voice.start(locale)                  | Starts listening for speech for a specific locale. Returns null if no error occurs.                                                                                     | Android, iOS |\n| Voice.stop()                         | Stops listening for speech. Returns null if no error occurs.                                                                                                            | Android, iOS |\n| Voice.cancel()                       | Cancels the speech recognition. Returns null if no error occurs.                                                                                                        | Android, iOS |\n| Voice.destroy()                      | Destroys the current SpeechRecognizer instance. Returns null if no error occurs.                                                                                        | Android, iOS |\n| Voice.removeAllListeners()           | Cleans/nullifies overridden `Voice` static methods.                                                                                                                     | Android, iOS |\n| Voice.isRecognizing()                | Return if the SpeechRecognizer is recognizing.                                                                                                                          | Android, iOS |\n| Voice.getSpeechRecognitionServices() | Returns a list of the speech recognition engines available on the device. (Example: `['com.google.android.googlequicksearchbox']` if Google is the only one available.) | Android      |\n\n\u003ch2 align=\"center\"\u003eEvents\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eCallbacks that are invoked when a native event emitted.\u003c/p\u003e\n\n| Event Name                          | Description                                            | Event                                           | Platform     |\n| ----------------------------------- | ------------------------------------------------------ | ----------------------------------------------- | ------------ |\n| Voice.onSpeechStart(event)          | Invoked when `.start()` is called without error.       | `{ error: false }`                              | Android, iOS |\n| Voice.onSpeechRecognized(event)     | Invoked when speech is recognized.                     | `{ error: false }`                              | Android, iOS |\n| Voice.onSpeechEnd(event)            | Invoked when SpeechRecognizer stops recognition.       | `{ error: false }`                              | Android, iOS |\n| Voice.onSpeechError(event)          | Invoked when an error occurs.                          | `{ error: Description of error as string }`     | Android, iOS |\n| Voice.onSpeechResults(event)        | Invoked when SpeechRecognizer is finished recognizing. | `{ value: [..., 'Speech recognized'] }`         | Android, iOS |\n| Voice.onSpeechPartialResults(event) | Invoked when any results are computed.                 | `{ value: [..., 'Partial speech recognized'] }` | Android, iOS |\n| Voice.onSpeechVolumeChanged(event)  | Invoked when pitch that is recognized changed.         | `{ value: pitch in dB }`                        | Android      |\n\n\u003ch2 align=\"center\"\u003ePermissions\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eArguably the most important part.\u003c/p\u003e\n\n### Android\n\nWhile the included `VoiceTest` app works without explicit permissions checks and requests, it may be necessary to add a permission request for `RECORD_AUDIO` for some configurations.\nSince Android M (6.0), [user need to grant permission at runtime (and not during app installation)](https://developer.android.com/training/permissions/requesting.html).\nBy default, calling the `startSpeech` method will invoke `RECORD AUDIO` permission popup to the user. This can be disabled by passing `REQUEST_PERMISSIONS_AUTO: true` in the options argument.\n\nIf you're running an ejected expo/expokit app, you may run into issues with permissions on Android and get the following error `host.exp.exponent.MainActivity cannot be cast to com.facebook.react.ReactActivity startSpeech`. This can be resolved by prompting for permssion using the `expo-permission` package before starting recognition.\n\n```js\nimport { Permissions } from \"expo\";\nasync componentDidMount() {\n\tconst { status, expires, permissions } = await Permissions.askAsync(\n\t\tPermissions.AUDIO_RECORDING\n\t);\n\tif (status !== \"granted\") {\n\t\t//Permissions not granted. Don't show the start recording button because it will cause problems if it's pressed.\n\t\tthis.setState({showRecordButton: false});\n\t} else {\n\t\tthis.setState({showRecordButton: true});\n\t}\n}\n```\n\n**Notes on Android**\n\nEven after all the permissions are correct in Android, there is one last thing to make sure this libray is working fine on Android. Please make sure the device has Google Speech Recognizing Engine such as `com.google.android.googlequicksearchbox` by calling `Voice.getSpeechRecognitionServices()`. Since Android phones can be configured with so many options, even if a device has googlequicksearchbox engine, it could be configured to use other services. You can check which serivce is used for Voice Assistive App in following steps for most Android phones:\n\n`Settings \u003e App Management \u003e Default App \u003e Assistive App and Voice Input \u003e Assistive App`\n\nAbove flow can vary depending on the Android models and manufactures. For Huawei phones, there might be a chance that the device cannot install Google Services.\n\n**How can I get `com.google.android.googlequicksearchbox` in the device?**\n\nPlease ask users to install [Google Search App](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox\u0026hl=en).\n\n### iOS\n\nNeed to include permissions for `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` inside Info.plist for iOS. See the included `VoiceTest` for how to handle these cases.\n\n```xml\n\u003cdict\u003e\n  ...\n  \u003ckey\u003eNSMicrophoneUsageDescription\u003c/key\u003e\n  \u003cstring\u003eDescription of why you require the use of the microphone\u003c/string\u003e\n  \u003ckey\u003eNSSpeechRecognitionUsageDescription\u003c/key\u003e\n  \u003cstring\u003eDescription of why you require the use of the speech recognition\u003c/string\u003e\n  ...\n\u003c/dict\u003e\n```\n\nPlease see the documentation provided by ReactNative for this: [PermissionsAndroid](https://reactnative.dev/docs/permissionsandroid.html)\n\n[npm]: https://img.shields.io/npm/v/@react-native-voice/voice.svg?style=flat-square\n[npm-url]: https://npmjs.com/package/@react-native-voice/voice\n[circle-ci-badge]: https://img.shields.io/circleci/project/github/react-native-voice/voice/master.svg?style=flat-square\n\n\u003ch2 align=\"center\"\u003eContributors\u003c/h2\u003e\n\n- @asafron\n- @BrendanFDMoore\n- @brudny\n- @chitezh\n- @ifsnow\n- @jamsch\n- @misino\n- @Noitidart\n- @ohtangza \u0026 @hayanmind\n- @rudiedev6\n- @tdonia\n- @wenkesj\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-native-voice%2Fvoice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freact-native-voice%2Fvoice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-native-voice%2Fvoice/lists"}