react-duration-voice-recorder
Version:
A react voice recorder component that records audio within a specified duration and generates audio file and url
68 lines (50 loc) • 1.85 kB
Markdown
This is a voice recorder with time duration.
To install via [npm](https://www.npmjs.com/).
```bash
npm install react-duration-voice-recorder
```
```javascript
import ReactDurationRecorder from 'react-duration-voice-recorder'
const MyComponent = () => {
return (
<ReactDurationRecorder
getFile={(file) => console.log(file)}
getUrl={(url) => console.log(url)}
showPreview={true}
timer={true}
btnClass='your button classname'
containerStyle={{
width: '300px',
border: '1px solid black',
padding: '10px'
}}
duration={{
hours: 0,
minutes: 0,
seconds: 30
}}
/>
)
}
```
- React
- react-media-recorder
- react-icons
- **getFile** : (REQUIRED) requires function that accepts file on clicking upload button
- **getUrl** : (REQUIRED) requires a function that accepts the blog url
- **showPreview**: (OPTIONAL)(boolean) shows audio element for preview. default will be true
- **timer**: (OPTIONAL)(boolean) shows timer while recording. default will be true
- **btnClass**: (OPTIONAL)(string) No default styles provided. Add classNames here
- **containerStyle**: (OPTIONAL)(object). Outer container. Accepts styleObject.
- **duration**: (OPTIONAL) (object). requires objects with keys hours(int),minutes(int),seconds(int). default will be 30 seconds
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](https://choosealicense.com/licenses/mit/)
## 💰 You can help me by Donating
[](https://www.buymeacoffee.com/shittycoder)