I learned to record here extendable-media-recorder but don't know how to save the recorded file to the local file by the path, can someone help me answer my question. thanks enter image description here
I learned to record here extendable-media-recorder but don't know how to save the recorded file to the local file by the path, can someone help me answer my question. thanks enter image description here
This example it will you provide help
example link : https://jsfiddle.net/r490zs7j/
var audioChunks;
startRecord.onclick = e => {
startRecord.disabled = true;
stopRecord.disabled=false;
// This will prompt for permission if not allowed earlier
navigator.mediaDevices.getUserMedia({audio:true})
.then(stream => {
audioChunks = [];
rec = new MediaRecorder(stream);
rec.ondataavailable = e => {
audioChunks.push(e.data);
if (rec.state == "inactive"){
let blob = new Blob(audioChunks,{type:'audio/x-mpeg-3'});
recordedAudio.src = URL.createObjectURL(blob);
recordedAudio.controls=true;
recordedAudio.autoplay=true;
audioDownload.href = recordedAudio.src;
audioDownload.download = 'mp3';
audioDownload.innerHTML = 'download';
}
}
rec.start();
})
.catch(e=>console.log(e));
}
stopRecord.onclick = e => {
startRecord.disabled = false;
stopRecord.disabled=true;
rec.stop();
}
<body>
<div>
<h2>Audio record and playback</h2>
<p>
<button id=startRecord>start</button>
<button id=stopRecord disabled>stop</button>
</p>
<p>
<audio id=recordedAudio></audio>
<a id=audioDownload></a>
</p>
</div>
</body>