I was hoping this was going to work for getting Android's MediaPlayer 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 MediaPlayer to use basic authentication unless perhaps using the FileDescriptor argument works? So I tried this but got the following error:
IllegalArgumentException: Expected file scheme in URI http://www.myserver.com/music.mp3
My code looks something like this:
File f = new File(new URL("http://www.myserver.com/music.mp3").toURI());
FileInputStream fis = new FileInputStream(f);
mediaplayer.SetDataSource(fis.getFD());
Is it correct to say that a FileDescriptor can only be used with local "file://" URLs and not normal "http://" URLs? If so, does anyone have any other ideas on how to stream from a server that requires authentication using Android's MediaPlayer?