I try to serve audio files from the end of Node / Express, to Angular.
Server Side Code:
var file = "/filepath.wav";
res.download(file, 'testAudio.wav');
Client Side Code:
var testData = null;
this.getBasicAudio = function(){
console.log("Requesting File");
$http.get('/getBasicAudio', "FilePathRequest")
.success(function(data){
console.log("File retrive Successful");
testData = data;
return true;
})
.error(function(data){
console.log("File retrive Failed");
return false;
});
};
This returns the file in order.
I am trying to load this into an Audio object, as if I were pasting a link to a file.
var audio = new Audio(testData);
But the object is null. From what I understand, I am returning a stream object from an expression, but I cannot find how to turn this into a reproducible sound.
edit: Is this because express loading () only works with non-binary data?
Thank!
source
share