react-native-sound-recorder-no-native

0.0.72 • Public • Published

React Native Sound Recorder (No Native)

A simple drop in sound recorder component for react native applications.

This module makes extensive use of the Expo.io Audio SDK located here. It includes a sensible set of audio setup defaults, but can be customised using the information contained in the expo.io documentation.

npm npm npm npm

Why Use This?

This module is useful if you need a drop in sound recording component for an application in which using platform specific native code is prohibited; for example an application created using expo.io.

Why Not Use This?

You are not restricted from using native code, and can find a better module to use.

Installation

npm install --save react-native-sound-recorder-no-native

Usage

import SoundRecorder from 'react-native-sound-recorder-no-native';

Example

 <SoundRecorder
    style={{ flex: 1 }}
    onComplete={this.soundRecorderComplete.bind(this)}
    maxDurationMillis={150000}
    completeButtonText={'Finished'}
/>

This component accepts the following props:

Name Type Default Description
onComplete (required) function none callback function executed when the user presses the finish recording button. Is passed sound file information (see below)
maxDurationMillis number 600000 (10 miniutes) maximum length of the recording in milliseconds
completeButtonText string finished text dsplayed on the button that executes the onComplete callback
audioMode object see below a set of key value pairs used to customize recording see Expo documentation
timeStampStyle object
{
color: 'blue',
fontSize: 40
}
style of the timestamp displayed while playing and recording
showTimeStamp boolean true determines whether or not to display timestamp
showDebug boolean false shows debug related items in a view on the recorder screen

Sound Clip information returned by this component

The onComplete callback receives an object similiar to the following

"size":115824,
"modificationTime":1515107376,
"uri":"file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540reggie3%252Freact-native-expo-sound-recorder/Audio/recording-20cfc766-faba-47cf-9914-8fc81b149012.m4a",
"isDirectory":false,
"exists":true,
"durationMillis": 34535

Default Audio Mode Object

allowsRecordingIOS:true
interruptionModeIOS:
Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
playsInSilentModeIOS: true,
playsInSilentLockedModeIOS: true,
shouldDuckAndroid: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX

Package Sidebar

Install

npm i react-native-sound-recorder-no-native

Weekly Downloads

1

Version

0.0.72

License

MIT

Last publish

Collaborators

  • reggie3