1.0.1 • Published 6 months ago

react-native-audio-recorder-button v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

react-native-audio-recorder-button

React Native Audio Recorder Button is a component for recording the audio and can play the recorded audio.

Installation

npm install react-native-audio-recorder-button

Installing dependencies

npm install react-native-permissions react-native-vector-icons react-native-sound @react-native-community/audio-toolkit react-native-easy-toast

Usage

import AudioRecorder from 'react-native-audio-recorder-button';

// ...

<AudioRecorder
  filename='AUDIO_FILENAME'
  onFinishRecord={(filePath) => {}}
  containerStyle={{padding: 20}}
  ...
/>

Properties

Basic

PropDefaultTypeOptionalDescription
filename''stringfalseFilename of the recorded audio (ex: test-audio.mp4)
disabledfalsebooleantrueStatus to disable the record button
primaryColor'#1b91f7'stringtruePrimary color of the buttons
instructionToastMessage''stringtrueToast message that will show when pressed on the record button (not long press)
androidPermissionTitle''stringtrueThe title of the request microphone permission on Android
androidPermissionDescription''stringtrueThe description of the request microphone permission on Android
iOSPermissionTitle''stringtrueThe title of the request microphone permission on iOS
iOSPermissionDescription''stringtrueThe description of the request microphone permission on iOS
iOSAlertCancelLabel'បិទ'stringtrueThe left button label of the iOS permission alert
iOSAlertSettingsLabel'ការកំណត់'stringtrueThe right button label of the iOS permission alert
onFinishRecord{}functiontrueThe function that will called when stop recording. It returns with the recorded audio file path and recorded audio duration
onDeleteAudio{}functiontrueThe function that will called deleteing the recorded audio

Custom styles

PropDefaultTypeOptionalDescription
containerStyle{...}styletrueStyle of the recorder container
recordDurationLabelStyle{...}styletrueStyle of the record duration label
recordButtonStyle{...}styletrueStyle of the record button
micIconStyle{...}styletrueStyle of the record button microphone icon
playDurationLabelStyle{...}styletrueStyle of the playing audio duration label
playIconStyle{...}styletrueStyle of the play icon style
pauseIconStyle{...}styletrueStyle of the pause icon style

Ref method

PropTypeOptionalDescription
setRecordButtonVisiblefuctionOptionalA reference fuction to set the visibility of the record button (ex: audioRef.current?.setRecordButtonVisible(true))
setRecordedFilefuctionOptionalA reference fuction to set audio file path and its duration (ex: audioRef.current?.setRecoredFile(FILE_PATH, 10))

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.


Made with create-react-native-library

1.0.1

6 months ago

1.0.0

6 months ago