Reputation: 651
I have used the excellent demo audio recorder at https://webaudiodemos.appspot.com/AudioRecorder/index.html
However, I need the audio file to be on the server. Rather than undoing what I have done so far is there a way I can take the created audio file and upload it to the server neatly?
Ok so following on from the comment, I have now changed the code as follows using a bit of jquery (old code commented out):
//Recorder.setupDownload = function(blob, filename){
// var url = (window.URL || window.webkitURL).createObjectURL(blob);
// var link = document.getElementById("save");
// link.href = url;
// link.download = filename || 'output.wav';
//}
Recorder.setupDownload = function(blob, filename){
$('#save').click(function(blob, filename) {
$.ajax({
url: 'process.php',
type: 'post',
filename: filename,
success: function(data) {
alert(data);
}
});
});
}
Which I think is nearly there, but it's not passing the data through do the ajax (which I'm still new to!).
Upvotes: 0
Views: 292
Reputation: 129
Just use the underlying RecorderJS and catch the packets from there. Then upload to your server via simple AJAX requests (HTTP POST). You will need to write some server side script to handle these packets and write to file.
Alternatively you can use a WebRTC server with built-in audio recording capabilities.
Upvotes: 1