使用recorder.js,我们可以使用forceDownload下载录制的音频文件。如何将此音频文件保存在服务器上,以便在需要时使用。
发布于 2016-01-08 22:14:50
Recorder.JS提供了一个exportWAV()函数,该函数将给回调一个包含音频的Blob。然后,您可以使用XmlHttpRequest将blob作为标准post请求发送到服务器。
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);
});https://stackoverflow.com/questions/18758400
复制相似问题