Access a URL and download a wav file using javascript

MrSaints

New Member
I am new to java and javascript programing. I was able to write a piece of code in java to access a particular URL and download the wav file from that URL (this url returns a wav file).\[code\]url = new URL('url name');input = url.openStream();output = new FileOutputStream (wavfile);byte[] buffer = new byte[500];int bytesRead = 0;while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) { output.write(buffer, 0, bytesRead);} output.close(); \[/code\]I do not want to do this in Java and want to be able to do it in Javascript. The main attempt is to use javascript and get the wav file and play it on a HTML5 enabled browser. I eventually want to put it on an android platform, so do not prefer to use ajax or jquery.Please suggest how this can be done in javascript.Thanks,axs
 
Top