Skip to content
[DEPRECATED] react-native-record-sound
Branch: master
Clone or download
Alex
Latest commit 57c6dc7 Dec 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android Update Android version Jun 21, 2016
ios updated import header Jan 16, 2017
.gitignore * new: initial commit Jun 3, 2016
.npmignore Update Android version Jun 21, 2016
README.md Update README.md Dec 7, 2018
index.js index.js instead of two .js Jun 10, 2016
package.json Update packager.json Jul 5, 2016

README.md

react-native-record-sound

[DEPRECATED]: I have to update the ObjC and Java code. And update RN version.

Installation

  • Install the module
npm i --save react-native-record-sound
  • In android/settings.gradle
...
include ':react-native-record-sound', ':app'
project(':react-native-record-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-record-sound/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-record-sound')
}
  • Register module (in MainActivity.java)
import com.reactnativerecordsound.ReactNativeRecordSoundPackager;  // <--- import

public class MainActivity extends ReactActivity {
  ......
  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new ReactNativeRecordSoundPackager()  // <------ add here     
    );
  }
  ......

}

How to use

import Record from 'react-native-record-sound';
let isRecording = false;
...
recordSound() {
  if (isRecording === false)
    Record.startRecord(path + 'sound.mp4', (err) => {console.log(err)});
  else   
    Record.stopRecord();
  isRecording = !isRecording;
}
You can’t perform that action at this time.