In my music stream program, how can I set proxy on android.media.MediaPlayer class for stream a link file through the proxy network ? I know about NTCreditional, UsernamePasswordCreditional, Proxy-Authorization Header and etc in HttpClient, URLConnection. But I can not set proxy on android.media.MediaPlayer, how can I do it?
Thanks for your advance 🙂
Unfortunately MediaPlayer API doesn’t provide a ready-to-use method for proxy setting at the moment.
how can I do it?
There is a possible workaround but quite dirty:
http://remotehost:80/music, using whatever technology you familiar with, socket, httpClient and etc. and handle proxy authentication properly here.http://localhost:8081/musicrunning on our mobile device.mediaPlayer.setDataSource(localURL);instead ofmediaPlayer.setDataSource(remoteURL);.Related Materials:
Hope this make sense.