title: How do I use FileDescriptor with HTTP URLs
body: <p>I was hoping this was going to work for getting Android's <code>MediaPlayer</code> to stream from a URL using authentication, but now I'm not so sure. I have no problem getting it to stream from an open server (no authentication) but I don't see any way to tell <code>MediaPlayer</code> to use basic authentication unless perhaps using the <code>FileDescriptor</code> argument works? So I tried this but got the following error:</p>
  
  <pre><code>IllegalArgumentException: Expected file scheme in URI http://www.myserver.com/music.mp3
  </code></pre>
  
  <p>My code looks something like this:</p>
  
  <pre><code>File f = new File(new URL("http://www.myserver.com/music.mp3").toURI());
  FileInputStream fis = new FileInputStream(f);
  mediaplayer.SetDataSource(fis.getFD());
  </code></pre>
  
  <p>Is it correct to say that a <code>FileDescriptor</code> can only be used with local <code>file://</code> URLs and not normal <code>http://</code> URLs? If so, does anyone have any other ideas on how to stream from a server that requires authentication using Android's <code>MediaPlayer</code>?</p>