I’m making a website that can record audio for 5 seconds, it works, but when the 5 seconds finish I want the audio to download or to be save in a folder of my project, is it posible? here is my code:
navigator.mediaDevices.getUserMedia({ audio: true })
.then(stream => {
const mediaRecorder = new MediaRecorder(stream);
mediaRecorder.start();
const audioChunks = [];
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();
});
And I want to make something like this
mediaRecorder.addEventListener("stop", () => {
const audioBlob = new Blob(audioChunks)
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
audio.save("direction-of-the-folder/") // MAKE this
});
Thank you in advance:)