Hi folks pls could you help I spend whole day trying to figure this out but no joy!
Trying to save get blob url and save it on server as mp3.
btnDownloadRecording.onclick = function() {
this.disabled = true;
if(!recorder || !recorder.getBlob()) return;
var blob = recorder.getBlob();
var file = new File([blob], getFileName('mp3'), {
type: 'audio/mp3'
});
// here
var http = new XMLHttpRequest();
var url = audioMessageUploader;
var fd = new FormData();
fd.append("audio-data", blob, file);
http.open('POST', url, true);
//Send the proper header information along with the request
//http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
//Call a function when the state changes.
http.onload=function(e) {
if(this.readyState === 4) {
console.log("Server returned: ",e.target.responseText);
}
};
//http.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
http.send(fd);
// here
};