2.1.0 • Published 3 years ago

use-record-mp3 v2.1.0

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

use-record-mp3

Record MP3s in React using hooks

Install

npm i use-record-mp3

Usage

import useUserMedia from "react-use-user-media";
import useRecordMp3 from "use-record-mp3";

const constraints = { audio: true };

const Example = () => {
  const { stream } = useUserMedia(constraints);
  const {
    isRecording,
    startRecording,
    stopRecording,
    blobUrl,
    channelData,
  } = useRecordMp3(stream, {
    vbrQuality: 2, // 1 (highest) to 9 (lowest)
  });

  return (
    <div>
      <button onClick={isRecording ? stopRecording : startRecording}>
        {isRecording ? "Stop" : "Record"}
      </button>
      {blobUrl && <audio controls src={blobUrl}></audio>}
    </div>
  );
};

Instead of vbrQuality you can specify bitrate (e.g. 96, 128).

Heads up

  • AirPods don't work. Pull requests accepted.

License

MIT © aaronshaf

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago