Skip to content
Michał Stocki edited this page Aug 30, 2014 · 1 revision

Welcome to the FlashWavRecorder wiki!

One of the most frequent questions is about uploading recording to server without user interaction. For many reasons present solution (forcing user to click Flash button) is inconvenient. In modern browsers we can send recorded audio using JavaScript.

Sending recording with JavaScript

var blob = FWRecorder.getBlob("recording_name");   // 1

var fd = new FormData();
fd.append("format", "json");   // 2
fd.append("field_name", blob, "recording_name.wav");   // 3
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost/FlashWavRecorder/html/upload.php");   // 4
xhr.send(fd);
  1. First of all we have to convert data, recorded by Flash to Blob object. We use a name of the recording - the same we've used to start recording (FWRecorder.record("recording_name")).
  2. We specify the format of response we expect from server.
  3. "field_name" is the field of virtual form, we send to server. This is the same name we have to provide, when we set up FlashWavRecorder for saving file with traditional method. To make it work with html/upload.php script - use "upload_file". We can also put recording_name.wav (optionally) - this is the name under which recording will appear on the server.
  4. The request url.

Note that for using this solution, your browser has to support File API, XMLHttpRequest2 and Blob constructing.

Supported browsers: IE 10+, Firefox 13+, Chrome 20+, Safari 6+, iOS Safari 6.1+, Android browser 3+ (support uncertain).

Clone this wiki locally