Skip to content

Latest commit

 

History

History
40 lines (34 loc) · 1 KB

README.md

File metadata and controls

40 lines (34 loc) · 1 KB

MP3Recorder

Record MediaStreamTrack to MP3 file in the browser

Usage

var stream = await navigator.mediaDevices.getUserMedia({
  audio: {
    channelCount: 2,
    sampleRate: 44100,
    noiseSuppression: false,
    autoGainControl: false,
    echoCancellation: false,
  }
});
var [audioTrack] = stream.getAudioTracks();

var recorder = await new MP3Recorder(audioTrack);
var start = await recorder.start();
recorder.stop().then(async(blob) => {
  console.log(URL.createObjectURL(blob));
  var handle = await showSaveFilePicker({
    suggestedName: "download.mp3",
    startIn:'music'
  });
  blob.stream().pipeTo(await handle.createWritable())
}).catch(console.error);

Dependencies

mp3.

MP3 (license) references

License

Do What the Fuck You Want to Public License WTFPLv2