pramodtech
pramodtech

Reputation: 6270

how to save audio file in recorder.js on server

Using recorder.js we can download recorded audio file using forceDownload. How can I save this audio file on server so that I can use it when required.

Upvotes: 2

Views: 7918

Answers (2)

Saqib
Saqib

Reputation: 7412

Recorder.JS provides an exportWAV() function, which will give the callback a Blob containing the audio. You can then use XmlHttpRequest to send the blob to your server as a standard post request.

recorder.stop();
recorder.exportWAV(function(audio) {
    var xhr = new XMLHttpRequest();
    xhr.open("POST", url, true);
    xhr.setRequestHeader("content-type", "audio/wav");
    xhr.onload = function(e) {
        // Handle the response.
    }
    xhr.send(audio);
});

Upvotes: 1

Muaz Khan
Muaz Khan

Reputation: 7236

Try RecordRTC-to-PHP.

RecordRTC is a library sits top of RecorderJs; provides recording of both audio and video streams, both on chrome and firefox.

See server side PHP code; along with javascript implementation.

Upvotes: 0

Related Questions