Reputation: 879
Trying to capture raw audio from a user using recorder.js and upload it to a server, I came across this site and it instructed to call function stopRecording() with a second argument and also to change _AudioFormat from "audio/wav" to "audio/mpeg".
Code snippet from my view:
$(".transBtn").click(function(){
if($(this).hasClass("transRecording")){
//var _AudioFormat = "audio/mp3";
var AudioFormat = "audio/mpeg";
stopRecording(function(AudioBLOB){
var url = URL.createObjectURL(AudioBLOB);
$(".downloadAud").attr("href" , url);
$(".downloadAud").attr("download" , "myRec.mp3");
var l = document.getElementById('save'); // save is the id of anchor tag
l.click();
}, AudioFormat);
}
else {
startRecording();
//alert("Live Recording");
}
})
Sorry to take your time but I'm unable to download the file in .mp3 format. I would be very glad if you helped.
Thanks in advance.
Upvotes: 0
Views: 1347