Coder Social home page Coder Social logo

superkalo / react-audio-recorder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danrouse/react-audio-recorder

0.0 1.0 1.0 159 KB

A React Component using the Web Audio API to record, save, and play audio.

JavaScript 84.43% CSS 9.72% HTML 5.85%

react-audio-recorder's Introduction

Audio Recorder

A React Component using the Web Audio API to record, save, and play audio.

Demo & Examples

Live demo: kremonte.github.io/react-audio-recorder

To build the examples locally, run:

npm install
npm start

Then open localhost:8000 in a browser.

Installation

The easiest way to use react-audio-recorder is to install it from NPM and include it in your own React build process (using Webpack, Browserify, etc).

You can also use the standalone build by including dist/react-audio-recorder.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install react-audio-recorder --save

Usage

The <AudioRecorder> component can be instantiated with no properties to act as a simple client-side recorder/downloader. onChange is called when a recording is finished, with the audio data passed as a blob.

import AudioRecorder from 'react-audio-recorder';

<AudioRecorder />

For more detailed usage examples, see the live demo.

Properties

prop type Description
audio Blob Audio data to load the component with, optional.
download bool Whether to show the download button after audio is recorded, default: true
loop bool Whether to loop playback, default: false
onAbort callback Called when playback is aborted.
onChange callback Called when audio is recorded or removed. Callback data is sent as an object: { duration: float, data: Blob }
onEnded callback Called when playback finishes.
onPlay callback Called when playback begins.
onRecordStart callback Called when recording begins.
strings object Button text values
strings.play string default: '๐Ÿ”Š Play'
strings.playing string default: 'โšโš Playing'
strings.record string default: 'โ— Record'
strings.recording string default: 'โ— Recording'
strings.remove string default: 'โœ– Remove'
strings.download string default: '\ud83d\udcbe Save'

Notes

This component is intended for use with short sounds only, such as speech samples and sound effects. The WAV encoder is not offloaded to a service worker, to make this component more portable. It is not space efficient either, recording at 1411kbps (16 bit stereo), so long recordings will drain the system of memory.

Compatibility

Because of its usage of the Web Audio API, react-audio-recorder is not compatible with any version of Internet Explorer (Edge is compatible).

Development (src, lib and the build process)

NOTE: The source code for the component is in src. A transpiled CommonJS version (generated with Babel) is available in lib for use with node.js, browserify and webpack. A UMD bundle is also built to dist, which can be included without the need for any build system.

To build, watch and serve the examples (which will also watch the component source), run npm start. If you just want to watch changes to src and rebuild lib, run npm run watch (this is useful if you are working with npm link).

License

PUT LICENSE HERE

Copyright (c) 2015 Dan Rouse.

react-audio-recorder's People

Contributors

danrouse avatar kevinrobinson avatar superkalo avatar

Watchers

 avatar

Forkers

kelvinninja1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.