whitebear
whitebear

Reputation: 12423

How to save the blob for media file?

I successfully make the wave data and get type and wave like this below.

then I use createObjectURL and it gives me the url http://localhost:3003/5025f231-f5d0-49f5-9851-600376de0065 but there is nothing.

How can I make the real file??

Any help appreciated...

console.log(type); //wave
console.log(data); //Blob {size: 6791616, type: "audio/wav"}
if (type == 'wav'){
 //how can I save the .wav file from blob and give the parameter for user?
      var dlUrl = URL.createObjectURL(data)
      console.log(dlUrl); //it shows http://localhost:3003/5025f231-f5d0-49f5-9851-600376de0065, but there is no 5025f231-f5d0-49f5-9851-600376de0065 file.
}

Upvotes: 0

Views: 2782

Answers (1)

PotatoParser
PotatoParser

Reputation: 1058

I believe you have to add a blob: in front of the url:

console.log(type); //wave
console.log(data); //Blob {size: 6791616, type: "audio/wav"}
if (type == 'wav'){
 //how can I save the .wav file from blob and give the parameter for user?
      var dlUrl = URL.createObjectURL(data)
      console.log('blob:' + dlUrl); //it shows http://localhost:3003/5025f231-f5d0-49f5-9851-600376de0065 and there is 5025f231-f5d0-49f5-9851-600376de0065 file.
}

Upvotes: 2

Related Questions