wavesurfer.js
wavesurfer.js copied to clipboard
record microphone example
Hey, please I just need a quick and basic working example to record microphone and save to file or buffer, but to show in the screen and play the recorded audio, the examples about this in wavesurfer does not show loading the recorded audio. Thanks!
See #1030 (or https://collab-project.github.io/videojs-record/examples/audio-only.html for full solution).
Hi, Please check code snippet file. check above mentioned ticket and just modify code there. Change Device Ready Event like this and you will get how to record or play audio
`const mediaRecorder;
const audioChunks = [];`
`wavesurfer.microphone.on('deviceReady', function(stream) {
console.info('Device ready!');
mediaRecorder = new MediaRecorder(stream);
mediaRecorder.start();
mediaRecorder.addEventListener('dataavailable', event=>{
audioChunks.push(event.data);
})
mediaRecorder.addEventListener("stop", () => {
const audioBlob = new Blob(audioChunks);
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
});
});
`
@nilesh121196 do u have a full working example?
Would also like a full working version