{"id":4672,"url":"https://github.com/kevinresol/react-native-sound-recorder","last_synced_at":"2025-04-07T10:22:40.228Z","repository":{"id":49604882,"uuid":"99551749","full_name":"kevinresol/react-native-sound-recorder","owner":"kevinresol","description":"Simplest Sound Recorder for React Native","archived":false,"fork":false,"pushed_at":"2021-06-12T09:35:52.000Z","size":122,"stargazers_count":121,"open_issues_count":5,"forks_count":37,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T08:08:47.113Z","etag":null,"topics":["android","audio","ios","react-native","recorder","sound"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/kevinresol.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}},"created_at":"2017-08-07T07:50:41.000Z","updated_at":"2025-03-11T10:04:49.000Z","dependencies_parsed_at":"2022-09-15T02:12:25.916Z","dependency_job_id":null,"html_url":"https://github.com/kevinresol/react-native-sound-recorder","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinresol%2Freact-native-sound-recorder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinresol%2Freact-native-sound-recorder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinresol%2Freact-native-sound-recorder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinresol%2Freact-native-sound-recorder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinresol","download_url":"https://codeload.github.com/kevinresol/react-native-sound-recorder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247632298,"owners_count":20970145,"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","audio","ios","react-native","recorder","sound"],"created_at":"2024-01-05T20:17:19.776Z","updated_at":"2025-04-07T10:22:40.203Z","avatar_url":"https://github.com/kevinresol.png","language":"Objective-C","funding_links":[],"categories":["Components"],"sub_categories":["Media"],"readme":"\n# react-native-sound-recorder\n\nNo-hassle Sound Recorder for React Native.\n\n#### There are existing libraries out in the wild\n\n- https://github.com/MisterAlex95/react-native-record-sound\n- https://github.com/jsierles/react-native-audio\n\n#### Why reinvent the wheel?\n\nAt the time of writing, the above libaries are either inconsistent or incomplete.\n\nFor example, the same `startRecording` call returns a `Promise` on Android but `null` in iOS.\n\nOr `stopRecording` doesn't give a promise/callback at all. So forcing user to do silly things like \"wait for 1 second\" in order to make sure file is well written to disk.\n\n## Getting started\n\n`$ npm install react-native-sound-recorder --save`\n\nor\n\n`$ yarn add react-native-sound-recorder`\n\n\n**if RN \u003e= 0.60.0**\n\nAutolink should work\n\n**if RN \u003c 0.60.0**\n\n### Mostly automatic installation\n\n`$ react-native link react-native-sound-recorder`\n\n### Manual installation\n\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-sound-recorder` and add `RNSoundRecorder.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNSoundRecorder.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import com.kevinresol.react_native_sound_recorder.RNSoundRecorderPackage;` to the imports at the top of the file\n  - Add `new RNSoundRecorderPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-sound-recorder'\n  \tproject(':react-native-sound-recorder').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-sound-recorder/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      compile project(':react-native-sound-recorder')\n  \t```\n## Permissions\n\n**iOS**: Add the following entry to `Info.plist`:\n\n```\n\u003ckey\u003eNSMicrophoneUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis sample uses the microphone to record your speech and convert it to text.\u003c/string\u003e\n```\n\n**Android**: Add the following entry to `AndroidManifest.xml`:\n\n```\n\u003cuses-permission android:name=\"android.permission.RECORD_AUDIO\" /\u003e\n```\n\n\n## Usage\n```javascript\nimport SoundRecorder from 'react-native-sound-recorder';\n\n// Note: You may need to request runtime permission(s) first.\n\nSoundRecorder.start(SoundRecorder.PATH_CACHE + '/test.mp4')\n\t.then(function() {\n\t\tconsole.log('started recording');\n\t});\n\nSoundRecorder.stop()\n\t.then(function(result) {\n\t\tconsole.log('stopped recording, audio file saved at: ' + result.path);\n\t});\n\t\n// Usage with Options:\n\n\n SoundRecorder.start(\n        SoundRecorder.PATH_CACHE + '/' + fileName + '.mp4',\n        {\n          quality: SoundRecorder.QUALITY_MAX,\n          format : SoundRecorder.FORMAT_AAC_ADTS,\n\n        }\n      ).then(function () {\n       \n \n      });\n```\n\t\n\n  \n  \n## API\n```haxe\nfunction start(path:String, ?options:Object):Promise\u003cVoid\u003e;\nfunction stop():Promise\u003c{path:String, duration:Int}\u003e;\nfunction pause():Promise\u003cVoid\u003e;\nfunction resume():Promise\u003cVoid\u003e;\n```\n\n### Options:\n\niOS:\n\n- `quality`:Enum (Check out the [constants][ios constants] prefixed with `\"QUALITY_\"`)\n- `format`:Enum (Check out the [constants][ios constants] prefixed with `\"FORMAT_\"`)\n- `bitRate`:Int, default: not set (will fail on iPhone5 if set)\n- `channels`:Int (1 or 2), default: 1\n- `sampleRate`:Int default: 16000\n\nAndroid:\n\n- `source`:Enum (Check out the [constants][android constants] prefixed with `\"SOURCE_\"`)\n- `format`:Enum (Check out the [constants][android constants] prefixed with `\"FORMAT_\"`)\n- `encoder`:Enum (Check out the [constants][android constants] prefixed with `\"ENCODER_\"`)\n- `channels`:Int (1 or 2), default: 1\n- `encodingBitRate`:Int, default: 64000\n- `sampleRate`:Int default: 16000\n\nNote that the above enums are platform-specific.\n\n### Path Constants\n\n- PATH_CACHE \n- PATH_DOCUMENT \n- PATH_LIBRARY (N/A on Android)\n\n[android constants]: https://github.com/kevinresol/react-native-sound-recorder/blob/master/android/src/main/java/com/kevinresol/react_native_sound_recorder/RNSoundRecorderModule.java#L40\n[ios constants]: https://github.com/kevinresol/react-native-sound-recorder/blob/master/ios/RNSoundRecorder.m#L15\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinresol%2Freact-native-sound-recorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinresol%2Freact-native-sound-recorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinresol%2Freact-native-sound-recorder/lists"}