0

i am trying to use the awesome Delivery.js to download an audio file and feed the results into an <audio> tag.

there is a good example here how to read a local file and play it, but not an example of using raw data that currently lives in a variable.

here is an example of the data made available by Delivery.js:

data: "T2dnUwACAAAAAAA-blah-blah-blah-blah-blah-blah-blah-blah..."
dataURLPrefix: "data:application/octet-stream;base64,"
isText: false
mimeType: "application/octet-stream"
name: "Eval_31-66_Sep_13_18_5.opus"
size: undefined
uid: "73cd985d-bd04-4753-b236-0bb882afd21b"

my exceptionally crude attempt at this went something like this:

$('audio').attr('src', file.dataURL() );

and file.dataURL() returns data that looks like this:

data:application/octet-stream;base64,T2dnUwACAAAAAAAAAABJ-blah-blah-blah

which did not work.

any suggestions would be most appreciated.

Community
  • 1
  • 1
edwardsmarkf
  • 1,387
  • 2
  • 16
  • 31
  • 1
    You can try making the dataURI into a Blob by reading this - http://stackoverflow.com/questions/12168909/blob-from-dataurl - and then creating ObjectURL (link for that you already supplied in the question). Finally, give the new URL to the audio and see if it works. – metal03326 Nov 14 '15 at 18:47
  • thanks - strangely enough, it appears to work just fine in FF but not chrome. i found a better way to do it anyways, just download by creating a temporary link (suggested on this forum). – edwardsmarkf Nov 23 '15 at 22:58

0 Answers0