Tuesday 5 December 2017

Having trouble saving an audio/ogg recording to file system with node.

On the client I am using the browser's mic to record audio. The result is this:Blob(36433) {size: 36433, type: "audio/ogg; codecs=opus"} I then send the data to my Node.js server and attempt to save the file:req.on('data', (data) => { fs.writeFileSync('someAudio.ogg', data); }); However, the .ogg file does not work, it seems corrupt or something. Do I need to encode it? It seems like it's already encoded on the clientside?Maybe I am sending the blob file incorrectly to Node.js?addAudio(projectId, blob) { let formData = new FormData(); formData.append('upload', blob); return this.httpClient.post('http://localhost:3000/api/projects/audio/' + projectId, formData, {responseType: "blob"}); }

Submitted December 05, 2017 at 07:49PM by Ryan_77

No comments:

Post a Comment