title: How to play .wav file from URL in web browser embed - Java
body: <p>I want to play a .wav sound file in embed default media player in IE. Sound file is on some HTTP location. I am unable to sound it in that player. </p>
  
  <p>Following is the code.</p>
  
  <pre><code>    URL url = new URL("http://www.concidel.com/upload/myfile.wav");
          URLConnection urlc = url.openConnection();
          InputStream is = (InputStream)urlc.getInputStream();
           fileBytes = new byte[is.available()];
           while (is.read(fileBytes,0,fileBytes.length)!=-1){}
  BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
           out.write(fileBytes);
  </code></pre>
  
  <p>Here is embed code of HTML.</p>
  
  <pre><code>&lt;embed src="CallStatesTreeAction.do?ivrCallId=${requestScope.vo.callId}&amp;agentId=${requestScope.vo.agentId}" type="application/x-mplayer2" autostart="0" playcount="1" style="width: 40%; height: 45" /&gt;
  </code></pre>
  
  <ol>
  <li>If I write in FileOutputStream then it plays well</li>
  <li>If I replace my code of getting file from URL to my local hard disk. then it also works fine.</li>
  </ol>
  
  <p>I don't know why I am unable to play file from HTTP. And why it plays well from local hard disk.</p>
  
  <p>Please help.</p>