microphone-recorder
It is a lib for sound recording on HTML, implemented by audioContext and webWorker
Install
$ npm install --save @bigear/microphone-recorder
Usage
import Recorder from "@bigear/microphone-recorder";
navigator.mediaDevices.getUserMedia({ audio: true }).then((mediaStreamObject) => {
const input = audio_context.createMediaStreamSource(mediaStreamObject);
const recorder = new Recorder(input);
recorder.record();
recorder.stop();
recorder.exportWAV("audio/wav", function(blob) {
const url = URL.createObjectURL(AudioBLOB);
const au = document.querySelector("audio");
au.controls = true;
au.src = url;
recorder.clear();
});
})