React Native Audio Recorder and Player

Hyo
dooboolab
Published in
3 min readMay 19, 2018

I’ve implemented react-native-audio-recorder-player module these days to support production app called COONI(android, ios). There are some other modules doing the same thing as I’ve implemented, but haven’t found simple, reliable library that did the both recording and playing audio.

There isn’t many downloads today, because I’ve just published the reliable version yesterday.

What this module can do for ease of development

  1. Supports playing audio in background.
  2. Able to grab the actual uri of audio file to later upload to server.
  3. Able to run audio in silent mode which most apps support in default. Note that I haven’t support this optionally.
  4. Able to implement the callback status of your recording or playing file.
  5. Supports handling audio in different thread so that your UI will not freeze while using the module in your app.
  6. Audio will be recorded in maximum volume as default. For default in ios, recorded audio tends to be really small.

Things to know to help you understand about recording and playing for each platform.

Most popular extension today for audio is mp3. However, each platform share different file format for audio. For android it is mp4, and for ios it is a m4a. You could change the format to mp3 in your device with supports of third party libraries that exist in each platform, however it isn’t 100% trusted in my sight of view. Also there was some delay in converting audio that may result in bad user experience. Therefore, I’ve chose not to do work in converting in device and rather grab that file and do some job in server side would be better.

Why this module is recommended

  1. You can save your time from finding out how each platform works differently in recording or playing.
  2. You can save your time working on supporting your needs in development such as playing audio in background mode or recording in maximum volume as default. I don’t understand why it isn’t default in ios.
  3. I want to hear more needs from you to upgrade this module. Please write up any issue.

How this module is used in production app COONI.

If you are interested, please go download COONI(android, ios) app.

Try react-native-audio-recorder-player

  • npm install -S react-native-audio-recorder-player for installing in node_modules.
  • Try actual project by git clone https://github.com/dooboolab/react-native-audio-recorder-player.git. Then cd Example && npm start.
  • Open up other terminal and type npm run ios will open up your ios simulator.
  • For android open up your emulator first then type npm run android.

--

--